1、切换 tabBarController 或者 push 一个controller时,离开 layer 动画所在的 controller 并且动画是执行状态时,回到layer 所在的 controller layer 动画会自动停止。
解决方案:
/* When true, the animation is removed from the render tree once its
* active duration has passed. Defaults to YES. */
someAnimation.removedOnCompletion = NO;
2、navigationController的rootVC 不能支持滑动返回手势,否则会造成页面freezing。
解决方案:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidDisappear:animated];
if (self.navigationController.viewControllers.count > 1) {
[self.navigationController.interactivePopGestureRecognizer setEnabled:YES];
} else {
[self.navigationController.interactivePopGestureRecognizer setEnabled:NO];
}
}
3、代码隐藏Grouped TableView上边多余的间隔
let contentTB = UITableView(frame:CGRect.zero ,style:UITableViewStyle.grouped)
// CGFloat.leastNormalMagnitude: The least positive normal number.
contentTB.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: CGFloat.leastNormalMagnitude))
4、tableView.reloadData() 刷新页面跳动 (iOS 11)
1、产生的原因
是在创建TableViewCelll的时候,系统给加了一个默认预估estimatedRowHeight的cell高度== UITableViewAutomaticDimension。
@property (nonatomic) CGFloat estimatedRowHeight NS_AVAILABLE_IOS(7_0); // default is UITableViewAutomaticDimension, set to 0 to disable
默认是UITableViewAutomaticDimension, 当设置这个属性是0的时候,就不会估算cell高度了。
iOS 11以后系统默认开启Self-Sizing,
Self-Sizing官方文档解释:大概是说我们不用再自己去计算cell的高度了,只要设置好这两个属性,约束好布局,系统会自动计算好cell的高度.
2、解决办法
contentTB.estimatedRowHeight = 0
contentTB.estimatedSectionHeaderHeight = 0
contentTB.estimatedSectionFooterHeight = 0
网友评论