3 回答
TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超8個(gè)贊
以下代碼僅適用于iPad。
self.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:modalVC animated:YES];
我會(huì)添加一個(gè)子視圖。
這是一個(gè)很好的討論。具體看一下評(píng)論。不只是答案。
模態(tài)視圖
如果我是你,我不會(huì)做。我將添加一個(gè)子視圖并執(zhí)行此操作。看來(lái)我可以更好地控制事物。
編輯:
正如Paul Linsay所提到的,自iOS 8起,所需要的只是UIModalPresentationOverFullScreen用于呈現(xiàn)ViewController的modalPresentationStyle。這也將覆蓋navigationBar和tabBar按鈕。
TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超10個(gè)贊
在iOS 8.0及更高版本中,可以通過(guò)將modalPresentationStyle屬性設(shè)置為UIModalPresentationOverCurrentContext來(lái)完成
//Set property **definesPresentationContext** YES to avoid presenting over presenting-viewController's navigation bar
self.definesPresentationContext = YES; //self is presenting view controller
presentedController.view.backgroundColor = [YOUR_COLOR with alpha OR clearColor]
presentedController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:presentedController animated:YES completion:nil];
- 3 回答
- 0 關(guān)注
- 1314 瀏覽
添加回答
舉報(bào)
