확장 가능한 테이블보기 셀을 만드는 방법은 무엇입니까?
-
15-11-2019 - |
문제
테이블 뷰 셀을 원합니다. 당신이 탭하면 높이가 자라게되어 텍스트를 보여줍니다.다시 탭하면 덜 높이 버전으로 돌아갑니다.이게 가능하며 그렇다면 어떻게해야합니까?미리 감사드립니다
해결책
Use
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
--
In
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
when the user taps on a row, set the new row height in an array somewhere, then call tableview reload to redraw. It will call cellForRowAtIndexPath and since you know which cell has a large height, you return the larger cell for that row, and heightForRowAtIndexPath will ensure it is displayed correctly.
제휴하지 않습니다 StackOverflow