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]];
在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]];
相关文章推荐
- iOS超精细详解之GCD
- 于ios7在遇到一些发展deprecated问题
- iOS 蓝牙开发资料收集
- fir.im Weekly - iOS9 适配开发教程
- fir.im Weekly - iOS9 适配开发教程
- ios 修正waring:Method override for the designated initializer of the superclass '-init' not found
- iOS官方Sample大全
- 【转】iOS中几种数据持久化方案:我要永远地记住你!
- iOS开发CGD买票
- iOS开发CocoaPods使用详细说明
- 关于iOS 9 的一些新特性
- iOS 音频播放的3中方式
- iOS开发脚踏实地学习day13-触摸事件和抽屉效果
- iOS 快速创建常用控件
- IOS CocoaPods安装和使用教程
- iOS相机字体英文转中文,相机全屏
- 关于IOS 开发 中的一些小技巧
- IOS 静态库/动态库 简单说明
- IOS中pushViewController:的卡顿问题
- IOS-系统提示框