iOS 11的那些坑

2017-12-19  本文已影响0人  ProgramTheApe

1.MJRefresh下拉刷新的时 很卡|| 界面乱跳动

 if (@available(iOS 11.0, *)) {

        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

        self.tableView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0);

        self.tableView.scrollIndicatorInsets = self.tableView.contentInset;

    }

2.iOS11 中UITableView默认最多加载10几个cell,如果想push进页面的时候UITableView显示到最后一个cell在iOS11中就会有问题,在iOS11中UITableView不会显示到最后一个cell,需要加条件告诉UITableView,我要加载所有的cell:

    self.tableView.estimatedRowHeight = 0;
    self.tableView.estimatedSectionHeaderHeight = 0;
    self.tableView.estimatedSectionFooterHeight = 0;
  1. UITableView显示最底部的cell
    /** tableView滚动到最底部 **/
 - (void) upTableViewlayout
{


    [self.tableView endEditing:YES];


    dispatch_async(dispatch_get_main_queue(), ^{

        [UIView transitionWithView: self.tableView duration: 0.35f options: UIViewAnimationOptionTransitionCrossDissolve  animations: ^(void) {

            [self.tableView reloadData];
            
            CGPoint offset = CGPointMake(0,self.tableView.contentSize.height - self.tableView.frame.size.height);
            
            if (offset.y < 0) {
       
                offset = CGPointMake(0, -64);
            }
            
            [self.tableView setContentOffset:offset animated:NO];
            
        } completion: ^(BOOL isFinished) {
            
        }];

    });
}
上一篇 下一篇

猜你喜欢

热点阅读