tableView尾部多處一部分空白高度


問題出現的原因:創建tableView時使用的style是UITableViewStylePlain
解決辦法:
在創建tableView時,self.automaticallyAdjustsScrollViewInsets = NO;
官方文檔是這么寫的:

@property(nonatomic, assign) BOOL automaticallyAdjustsScrollViewInsets

 
Discussion
Default value is  YES, which allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar. Set to  NO if you want to manage scroll view inset adjustments yourself, such as when there is more than one scroll view in the view hierarchy.
 
原因二:創建tableView時使用的style是UITableViewStyleGrouped,那么會為footer自動預留位置。
由於此原因,使用上面方法的話是沒有用的。需要設置footer的height值為0.001,及無限接近0但是直接賦值為0的話也沒有作用。
-(CGFloat)tableView:(UITableView *)tableView heightaForFooterInSection:(NSInteger)section{
     return 0.001;
}
 
具體原因還沒沒明白。
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM