开发者

UITableView rowHeight change on air

开发者 https://www.devze.com 2023-03-24 06:34 出处:网络
I would like to achieve the same effect as in Reminders (iOS 5). There is a table row height dynamically changing on text view height change.

I would like to achieve the same effect as in Reminders (iOS 5). There is a table row height dynamically changing on text view height change.

Imagine I use UITextView in UITableViewCell. I will outst开发者_如何学Goretch this text view in cell, disable scroller and so on... I also will be updating the text view height on its content size height on air. But there is a problem with updating a cell height.

I consider to use – tableView:heightForRowAtIndexPath: for appropriate indexPath, but I wonder how to invoke this method. I think of calling – reloadRowsAtIndexPaths:withRowAnimation: but I think, this would reload cell completely and the text in text view would be lost.

Am I missing something or completely wrong? Or should I play with it this way... say caching the cell content and returning it after cell reload? Thank you!


I've written a small tutorial on how to solve this problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消