簡體   English   中英

iPhone,UINavigationController和UITabBar如何呈現模式對話框,無論選擇哪個選項卡?

[英]iPhone, UINavigationController and UITabBar how to present a modal dialog regardless of the selected tab?

我在應用程序中有一個UINavigationController和一個UITabBar。 標簽欄中的每個ViewController都有自己的UINavigationController。

無論當前選擇的選項卡如何,我都希望能夠向用戶呈現模式對話框(警報/提醒/合法/加入郵件列表)。

現在我有一個我的UIViewControllers處理呈現對話框的行為,但除非選中了選項卡,否則用戶將看不到它。

我該如何解決這個問題? 故事板浮現在腦海中,但我的項目太深,無法在當前狀態下重寫故事板。

謝謝!

你可以在UITabBarController上呈現它。

[tabBarController presentModalViewController:animated:];

...或者您可以輕松地將UIAlertView /創建類別 子類化為顯示自定義模態視圖,只需調用即可

UIAlertView *alert = 
  [[UIAlertView alloc] initWithTitle:@"" 
                             message:@"" 
                            delegate:nil 
                   cancelButtonTitle:@"" 
                   otherButtonTitles:nil];

[alert showCustom]; // <---- FROM CATEGORY

[alert release];

這是一個例子: http//goo.gl/7jaE8

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM