效果:弹出半页控制器;关键字:modalPresentationStyle、UIModalPresentationOverCurrentContext

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:此处涉及到一项技术,弹出的半页其实是跳转到下一个页面,为了有弹出半夜的效果,跳转的时候截取了当前页的屏幕图片作为半夜的背景。如想知道如何获取截屏,联系我。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容