簡體   English   中英

將2模式呈現中的viewController撤消到特定的viewController

[英]Dismiss a viewController from 2 modal presentation to especific viewController

我有下一個

我的故事板

我想將vc3轉換為vc2,但事實是它是由vc1呈現的,因此當我執行dismissViewController時,它將返回VC1,在從vc1到vc3的導航中,我從不實例化或顯示Vc2

任何想法?

創建一個委托方法,當您關閉VC3時將調用該方法,因此當委托傳遞給VC1時,請按VC2

嘗試這個 :-

 NSMutableArray *navigationArray = [[NSMutableArray alloc] initWithArray: self.navigationController.viewControllers];

// [navigationArray removeAllObjects];    // This is just for remove all view controller from navigation stack.
MyFansViewController *vc3 = [[MyFansViewController alloc] init];
[navigationArray removeObjectAtIndex: 2]; // You can pass your index here
[navigationArray addObject:vc3];
self.navigationController.viewControllers = navigationArray;

我還沒有測試過,但是經過一些修改它就可以工作

暫無
暫無

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

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