簡體   English   中英

從AppDelegate觸發序列,以在StoryBoard中彈出視圖

[英]Trigger a seque from the AppDelegate to popup a view in the StoryBoard

我正在嘗試將我的應用程序轉換為情節提要,但遇到了一些問題。 在以前的模型中,我可以在AppDelegate中有一個“ actionClass”,當我需要彈出視圖時可以調用它。

例如

DOArticleViewController *articleView = [[DOArticleViewController alloc] initWithArticle:article notification: notification nibName:@"DOArticleViewController" bundle:nil];
[[self navigationController] pushViewController:articleView animated:YES];  

但是現在有了情節提要,它不再起作用了。 然后,我在AppDelegate中嘗試了以下代碼:

id currentController = [[[[self window] rootViewController] navigationController] visibleViewController];
[currentController performSegueWithIdentifier:@"settingsSeque" sender:nil];

別以為這是最好的,因為只有rootViewController具備了所有必要的功能,並且可能不是visibleViewController,而是一次僅一步。

有了這個,我唯一看到的就是消息,沒有任何動作:

UINavigationController的開始/結束外觀轉換的不平衡調用:0xb428e00。

我現在花了幾個小時來試圖弄清楚它是否起作用,但是我意識到回到傳統的獨立XIB文件可能會更好。

我用以下問題給出的答案解決了: ios:從應用程序委托訪問導航控制器

我嘗試獲取導航控制器,但這沒有任何幫助,但我沒有意識到。 我的導航控制器是rootViewController,所以它也是NavigationController。

之后,將rootViewController轉換為NavigationController並調用'visibleViewController'可以正常工作!

暫無
暫無

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

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