iOS 弹出透明controller效果

来源:互联网 发布:淘宝919有活动吗 编辑:程序博客网 时间:2024/05/02 01:27

想要弹出一个透明的controller可以通过设置modalPresentationStyle来达到, 有的同学可能试过不行,那么可能是你是在IOS8以后的, IOS8需要设置将要弹出的controller的modalPresentationStyle

代码:

    TargetViewController *commentVC =  [[TargetViewController alloc]init];    if(iOS8){        targetVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;    }else{        self.modalPresentationStyle = UIModalPresentationCurrentContext;    }    [self presentViewController:targetVC animated:NO completion:nil];
0 0