IOS development-automaticallyAdjustsScrollViewInsets attributes
This is a problem recently encountered. Generally, an App has a UINavigationController. If TableView on the top has tableHeaderView, if the starting position is (), it is under the navigation bar, in order to better enable the UI, you may encounter this problem from the screen (0, 0). Let's take a brief look at the effect: the main code is as follows:-(UITableView *) tableView {if (! _ TableView) {_ tableView = [[UITableView alloc] initWithFrame: CGRectMake (0, 0, CGRectGetWidth (self. view. bounds), CGRectGetHeight (self. view. bounds) style: UITableViewStylePlain]; // _ tableView. tableFooterView = [[UIView alloc] init]; _ tableView. rowHeight = 40.0; _ tableView. sectionHeaderHeight = 0.0; _ tableView. sectionFooterHeight = 0.0; _ tableView. dataSource = self; _ tableView. delegate = self;} retu Rn _ tableView;}-(NSInteger) tableView :( UITableView *) tableView numberOfRowsInSection :( NSInteger) section {return 5;} // http://www.cnblogs.com/xiaofeixiang technical exchange: 228407086-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {UITableViewCell * cell = [[UITableViewCell alloc] init]; cell. textLabel. text = @ "-FlyElephant"; return cell;} set automaticallyAdjus at this time The effect of tsScrollViewInsets is as follows: the official documents are explained as follows: A Boolean value that indicates whether the view controller shocould automatically adjust its scroll view insets. declarationSWIFTvar automaticallyAdjustsScrollViewInsets: BoolOBJECTIVE-C @ property (nonatomic, assign) BOOL determines default value of this property 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. availabilityAvailable in iOS 7.0 and later. to put it simply, automaticallyAdjustsScrollViewInsets automatically adjusts the inset of the scrollview according to the status bar, navigationbar, and tabbar of the UI., Set it to no. we can modify the layout by ourselves instead of making adjustments to viewController ~