本文共 1163 字,大约阅读时间需要 3 分钟。
- (IBAction)setTenantBtn:(UIButton *)sender { TenantViewController *tenantViewController=[[TenantViewController alloc]init]; //tenantViewController.view.backgroundColor=[UIColor colorWithRed:180 green:180 blue:180 alpha:0.5]; tenantViewController.view.backgroundColor=[[UIColor blackColor]colorWithAlphaComponent:0.7];//背景透明 tenantViewController.modalPresentationStyle=UIModalPresentationOverCurrentContext;//覆盖全屏并可以透明,模态跳出方式 [self presentViewController:tenantViewController animated:YES completion:nil];//模态跳出 }
TenantViewController类的某一个点击事件模态退出:
- (IBAction)confirmBtnClicked:(UIButton *)sender { [self dismissViewControllerAnimated:YES completion:nil];}
模态视图弹出样式:
//跳转之后覆盖整个屏幕,不透明 UIModalPresentationFullScreen = 0, //跳转之后覆盖整个屏幕,不透明 UIModalPresentationPageSheet //跳转之后覆盖整个屏幕,不透明 UIModalPresentationFormSheet //跳转之后覆盖当前内容(除导航栏和标签栏部分),不透明 UIModalPresentationCurrentContext //跳转之后显示自定制视图(默认是覆盖整个屏幕),可以透明 UIModalPresentationCustom //跳转之后覆盖整个屏幕,可以透明 UIModalPresentationOverFullScreen //跳转之后覆盖当前内容(除导航栏和标签栏部分),可以透明 UIModalPresentationOverCurrentContext //跳转之后覆盖整个屏幕,不透明 UIModalPresentationPopover
转载地址:http://uiwin.baihongyu.com/