拡張可能なテーブルビューセルを作成する方法
-
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