在estimatedHeightForRowAtIndexPath方法中,实测如果返回高度小于等于1,会导致程序崩溃。错误原因:table view row height must not be negative,建议返回高度做大于1的保护,不知道苹果官方啥时候会修这个问题。
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { return 1.01; }
具体可见UITableView crash after i implemented estimatedHeightForRowAt indexPath`?
estimatedHeight 返回高度小于等于1导致的崩溃(Error:table view row height must not be negative)
最新推荐文章于 2024-03-20 10:03:23 发布
本文详细介绍了在UITableView中实现estimatedHeightForRowAtIndexPath方法时遇到的崩溃问题。当返回的高度小于等于1时,程序会因tableviewrowheightmustnotbenegative错误而崩溃。文中提供了一个简单的解决方案,即确保返回的高度始终大于1,以此避免程序崩溃。
&spm=1001.2101.3001.5002&articleId=104734255&d=1&t=3&u=247e02556e824bbba7db937226554a8e)
436

被折叠的 条评论
为什么被折叠?



