我试图以模态的方式呈现一个具有透明背景的视图控制器。我的目标是让呈现和呈现视图控制器的视图同时显示。问题是,当演示动画结束时,演示视图控制器的视图将消失。
- (IBAction)pushModalViewControllerButtonPressed:(id)sender
{
    ModalViewController *modalVC = [[ModalViewController alloc] init];
    [self presentViewController:modalVC animated:YES completion:nil];
}我知道我可以将视图添加为一个子视图,但出于某些原因,我想避免这种解决方案。我怎么才能修复它呢?
发布于 2016-06-23 16:06:01
具有透明背景的PresentViewController -在iOS 8和iOS 9中
MYViewController *myVC = [self.storyboard   instantiateViewControllerWithIdentifier:@"MYViewController"];
    myVC.providesPresentationContextTransitionStyle = YES;
    myVC.definesPresentationContext = YES;
    [myVC setModalPresentationStyle:UIModalPresentationOverCurrentContext];
    [self.navigationController presentViewController:myVC animated:YES completion:nil];并在MYViewController中设置背景颜色为黑色并减少不透明度
https://stackoverflow.com/questions/12741224
复制相似问题