您的位置:首页 > 移动开发 > IOS开发

IO7 和IOS8 弹出透明模态窗体

2015-09-22 19:03 387 查看
ViewControllerA  父窗体 ViewControllerB 为弹出窗体 

在IOS8之前使用ViewControllerA.modalPresentationStyle=UIModalPresentationCurrentContext;可以弹出,如果在IOS8 之后 这样写法 弹出的 ViewControllerB 为黑色 无法设置透明度

其中例子如下

//源Controller中跳转方法实现  ,不支持旋转。

    ViewControllerB *lagerPicVC = [[ViewControllerB alloc] init];
    if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {

       //注意设置的对象已经变成ViewControllerB

        lagerPicVC.modalPresentationStyle=UIModalPresentationOverCurrentContext;
    }else{

     //如果是IOS7的话设置的是父窗体

        self.modalPresentationStyle=UIModalPresentationCurrentContext;

    }
    [ViewControllerB presentViewController:lagerPicVC animated:YES completion:nil];

其中在ViewControllerB  设置透明要使用

[self.view
setBackgroundColor:[UIColor
colorWithRed:0
green:0
blue:0
alpha:0.468f]];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: