在模态弹出页面时,如果需要将弹出的页面设置为透明的,我们需要将弹出页面的modalPresentationStyle
设置为UIModalPresentationOverCurrentContext
但是由于UIModalPresentationOverCurrentContext
的特性问题,会产生一个透明的视图覆盖在前一个页面,在我们dismiss以后,这个视图偶现不会退出,导致前一个页面无法响应。以下是解决方案:
[self dismissViewControllerAnimated:YES completion:^{
/**
由于该特性设置self.modalPresentationStyle = UIModalPresentationOverCurrentContext; 导致需要添加以下代码
否则在dismiss返回到上一个页面,会导致上一个页面被一层透明视图遮挡无法响应事件
*/
[self.presentingViewController.view.subviews.lastObject removeFromSuperview];
}];