IOS彈出一個半透明的框

到新公司后,想養(yǎng)成一個好習(xí)慣,寫博客,多做分享,就根據(jù)自己平時的工作內(nèi)容來做分享吧

場景是有一個UIViewController ,點一個按鈕 彈出一個半透明框,然后點擊框上確認(rèn)按鈕,框消失

-(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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容