UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
XHDLoanConfirmViewController *presentedVC = [[XHDLoanConfirmViewController alloc] init];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
// presentedVC 为被弹出的控制器
presentedVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
} else {
// rootVC 为window的rootViewController
rootVC.modalPresentationStyle = UIModalPresentationCurrentContext;
}
presentedVC.view.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.4];
// self 为当前控制器
[self presentViewController:presentedVC animated:NO completion:nil];
PS:此处涉及到一项技术,弹出的半页其实是跳转到下一个页面,为了有弹出半夜的效果,跳转的时候截取了当前页的屏幕图片作为半夜的背景。如想知道如何获取截屏,联系我。