蜗牛爱课 - iOS7、8模态半透明弹出框

//源Controller中跳转方法实现  

 MKDialogController *controller = [[MKDialogController alloc] init];  

 controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;  // 跳转时的动画效果,可以修改

if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {  

    controller.providesPresentationContextTransitionStyle = YES;  

   controller.definesPresentationContext = YES;  

  controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;  

 [self presentViewController:controller animated:YES completion:nil];  

 } else {  

   self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;  

     [self presentViewController:controller animated:NO completion:nil];  

   self.view.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;  

}  

通过上面的方法模态出的新页面的self.view设置有透明的时候,就可以看到上一层controller的页面。


版权声明:欢迎转载,请注明出处:蜗牛爱课 • 移动互联网
posted @ 2016-01-25 18:32  北狐  阅读(574)  评论(0编辑  收藏  举报