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

你可能感兴趣的:(IOS弹出一个半透明的框)