1. 模态弹出半透明界面
效果图:
效果图
//#define rgbaColor(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
CdConferenceFreeViewController *freeVc = [CdConferenceFreeViewController new];
freeVc.view.backgroundColor = rgbaColor(0, 0, 0, 0.4);//设置ViewController的背景颜色及透明度
//设置ViewController的模态方式
freeVc.modalPresentationStyle = UIModalPresentationOverFullScreen;//显示方式
freeVc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;//弹出方式
self.viewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.viewController presentViewController:freeVc animated:YES completion:nil];
2. modalPresentationStyle & modalTransitionStyle
UIModalPresentationStyle viewcontroller显示方式
modalTransitionStyle viewcontroller弹出方式
模态显示:
typedefNS_ENUM(NSInteger, UIModalPresentationStyle) {
UIModalPresentationFullScreen =0,//由下到上,全屏覆盖
UIModalPresentationPageSheet,//在portrait时是FullScreen,在landscape时和FormSheet模式一样。
UIModalPresentationFormSheet,// 会将窗口缩小,使之居于屏幕中间。在portrait和landscape下都一样,但要注意landscape下如果软键盘出现,窗口位置会调整。
UIModalPresentationCurrentContext,//这种模式下,presented VC的弹出方式和presenting VC的父VC的方式相同。
UIModalPresentationCustom,//自定义视图展示风格,由一个自定义演示控制器和一个或多个自定义动画对象组成。符合UIViewControllerTransitioningDelegate协议。使用视图控制器的transitioningDelegate设定您的自定义转换。
UIModalPresentationOverFullScreen,//如果视图没有被填满,底层视图可以透过
UIModalPresentationOverCurrentContext,//视图全部被透过
UIModalPresentationPopover,
UIModalPresentationNone ,
};
模态弹出:
typedef NS_ENUM(NSInteger, UIModalTransitionStyle) {
UIModalTransitionStyleCoverVertical = 0, // 底部滑入。
UIModalTransitionStyleFlipHorizontal, // 水平翻转。
UIModalTransitionStyleCrossDissolve, // 交叉溶解。
UIModalTransitionStylePartialCurl, // 翻页。
};
网友评论