iOS开发UITableView随笔
生活随笔
收集整理的這篇文章主要介紹了
iOS开发UITableView随笔
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、設置cell的間隔
- (void)setFrame:(CGRect)frame{frame.size.height -=10;[super setFrame:frame]; }2、刷新row或者section(一定要初始化NSArray和NSIndexSet,不用用字面量初始化 會閃退)
[myTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];[myTableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:UITableViewRowAnimationNone];3、TableView的UITableViewAutomaticDimension和estimatedRowHeight
UITableViewAutomaticDimension:自適應單元格高度 (默認也是這個)
estimatedRowHeight:是一個預估高度,iOS11之前是為0,在iOS11下,這個值默認為44。減少調用heightForRowAtIndexPath方法以提高性能。
轉載于:https://www.cnblogs.com/xianfeng-zhang/p/9294930.html
總結
以上是生活随笔為你收集整理的iOS开发UITableView随笔的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [AI/GPT/LLOps/AI中台]
- 下一篇: Ubuntu通过VMware虚拟机安装步