问题
iOS15模态视图下拉返回之后迅速右滑(调用系统自带的侧滑返回) 程序会卡死
这个问题目前只在iOS15上有发现
查看被卡死的视图可以发现在controller上面多了一层透明的UIParallaxDimmingView(这是self.view的父视图),不太清楚为什么它没有被销毁。
解决方法
1、可以直接禁用模态视图的下拉返回功能
self.modalInPresentation = YES;
这个方法不太好,推荐用第二种
2、使用模态视图的时候将右滑返回禁用,当模态视图销毁的时候再将禁用解除
CourseViewController *con=[[CourseViewController alloc]init];
[self.navigationController presentViewController:con animated:YES completion:nil];
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
con.dismissBlock = ^{
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
};
//CourseViewController.m
-(void)dealloc{
if (self.dismissBlock) {
self.dismissBlock();
}
}
这一块也可以使用代理、通知都可以
以上是我自己的解决办法,新人刚开始学iOS,大家有什么更好的办法,欢迎指教!!!