我想展示一个不会使背后的内容变暗的模式视图控制器。仅使用标准的presentViewController。仅将视图控制器的子视图添加到父视图会导致问题。
最佳答案
试试这个:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// remove the dimming view if needed, when this view controller will appear as modal
id <UIViewControllerTransitionCoordinator> transitionCoordinator = self.transitionCoordinator;
if (transitionCoordinator.presentationStyle != UIModalPresentationNone) {
for (UIView *transitionContainerSubview in transitionCoordinator.containerView.subviews) {
if ([NSStringFromClass([transitionContainerSubview class]) isEqualToString:@"UIDimmingView"]) {
transitionContainerSubview.hidden = YES;
}
}
}
}