2014-11-14 116 views
2

我有一個彈出窗口,裏面有TabBarController。在一個選項卡中有一個帶有名稱列表的TableViewController。還有一個加號按鈕,它具有添加新名稱的AddCharacterVC模式。 在iOS的7我不喜歡這樣寫道:iOS 8 - 彈出窗口中的模態

AddCharacterViewController *acvc = (AddCharacterViewController *)segue.destinationViewController; 
acvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
acvc.modalPresentationStyle = UIModalPresentationCurrentContext;// so it does not take full screen in popover 

而在AddCharacterVC我設置內容的大小是這樣的:

- (void)viewWillAppear:(BOOL)animated { 

CGSize size = CGSizeMake(320, 480); // size of view in popover 
if (IDIOM == IPAD && [self respondsToSelector:@selector(preferredContentSize)]){ 
    self.preferredContentSize = size; 
} 

而且它完美的作品。

但是,在iOS 8模式視圖不包括整個彈出窗口,使TabBar可見。用戶可以點擊或不點擊,無論如何,模態視圖不會放鬆。

我已經試過:

  • 設置acvc.modalPresentationStyle到UIModalPresentationOverCurrentContext
  • 試圖設置的TabBar隱藏
  • 在故事板是TableVC的邊緣模式視圖下底欄和底部酒吧擴展(檢查AddCharacterVC)設置爲無。

全部沒有結果。

現在我唯一能想到的是嘗試使modalPresentationStyleCustom和使用UIPresentationController(我現在試圖做,但我沒有做過之前)。我錯過了什麼嗎?有沒有其他辦法可以做到這一點?抱歉,我還無法在此發佈圖片。提前謝謝了!

回答

0

好的,所以我設置了modalPresentationStile爲UIModalPresentationCustom,並使用了UIPresentationController - 我剛剛從WWDC-14的LookInside項目中複製了代碼並對其進行了一些修改。 我不確定它是否是最好的解決方案,但它對我的情況起作用。