UITableiViewCell 的点击事件无效
原因就是contenView变成了懒加载,如果cell内未使用contenview,则查看层级可以发现在cell内多了一个UITableViewCellContentView
累的对象,遮挡了cell. addSubView
方式添加的视图。
解决方式:
- 隐藏contentView,
contentView.isHidden = true
- 将view添加到contentView上
iOS14 missing TabBar on popping multiple ViewControllers
- 设置pushViewController
// fix: sometimes push and then popback no tabbar error
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.viewControllers.count == 1) {
viewController.hidesBottomBarWhenPushed = YES;
} else {
viewController.hidesBottomBarWhenPushed = NO;
}
[super pushViewController:viewController animated:animated];
}
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
if viewControllers.count == 1 {
viewController.hidesBottomBarWhenPushed = true
}else {
viewController.hidesBottomBarWhenPushed = false
}
super.pushViewController(viewController, animated: animated)
}
- 直接将弹出动画改为
false
[UINavigationController popToRootViewControllerAnimated:NO];
navigationController?.popToRootViewController(animated: false)