IOS弹出一个半透明的框

到新公司后,想养成一个好习惯,写博客,多做分享,就根据自己平时的工作内容来做分享吧

场景是有一个UIViewController ,点一个按钮 弹出一个半透明框,然后点击框上确认按钮,框消失

-(IBAction)buttonClick:(id)sender

{

UIButton * uiButton = (UIButton *)sender;

if(uiButton.tag ==1){

//UIViewController

TransparentController * transparentVC = [[TransparentController alloc] initWithNibName:@"TransparentController" bundle:nil];

if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {

transparentVC.modalPresentationStyle=UIModalPresentationOverCurrentContext;

}else{

self.modalPresentationStyle=UIModalPresentationOverFullScreen;

}

[self presentViewController:transparentVC animated:YES completion:nil];

}else{

//UIView

UIViewAlert *alert = [UIViewAlert nibInstance];

[alert show];

}

}

具体的demo,我往后后整理出来


github地址:

https://github.com/likaiwork/TransparentViewDemo

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容