AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UIViewController *vc = [[UIViewController alloc] init];
appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[appDelegate.window.rootViewController presentViewController:vc animated:YES completion:^{
vc.view.backgroundColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:0.8];
appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
}];
- iOS 8:利用最新的
modalpresentationstyle:UIModalPresentationOverCurrentContext
TestController *vc = [[TestController alloc] init];
vc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:vc animated:NO completion:^{
vc.view.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.8];
}];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者