iOS UItableViewは一部空白が多い

640 ワード

問題の原因:tableViewを作成するときに使用するスタイルはUItableViewスタイルPlainです.
解決策:
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.