我在这里的帖子中看过这个问题,但找不到我的错误。
我有vc1,在需要时可以使用vcDetail。
我还有一个vc2,在需要时会转到vcDetail。
vc1和vc2在选项卡控制器下组织。 vcDetail不是。
vc1到vcDetail segue在故事板中建立,并在行动中解雇。
vc2到vcDetail segue在故事板中建立,并在行动中解雇。
vcDetail dismiss按钮被“连线”到Exit。使用'selected'方法myUnwindAction。
myUnwindAction在vc1和vc2中实现。相同。在.h文件中定义。 (当我点击vcDetail的unwind segue时,vc1和vc2都会在故事板编辑器中点亮)。
问题:我的vcDetail永远不会退回到vc2。它似乎只是放松到vc1。
场景:
- 显示在vcLogin标签上。
- tab到vc1,segue到vcDetail。放松到vc1。确定。
- tab to vc2,segue to vcDetail。放松到vc1 - 错了。需要返回调用者,vc2。
或:
- 显示在vcLogin标签上。
- 标签到vc1,不要偏离。
- tab to vc2,segue to vcDetail。放松到vc1 - 错了。需要返回调用者,vc2。
我被困住了。如何返回正确的vc调用者?就好像无论来源一样,展开总是返回到vc1的“myUnwindAction”。好像vc2不存在。还有unwind方法,故事板编辑器似乎知道两者都参与了myUnwindAction(因此提到了突出显示)。
答案 0 :(得分:0)
You have to create different unwind segue for each Tab's View Controller
create unwind method in VC2 like
-(IBAction)unwindFromvcDetailToVC2:(UIStoryboardSegue*)sender;
create unwind method in VC1 like
-(IBAction)unwindFromvcDetailToVC1:(UIStoryboardSegue*)sender;
set Both unwindSegue through Storyboard
Depend on ur condition/requirement call
[self performSegueWithIdentifier:@"unwindFromvcDetailToVC2" sender:nil];
or
[self performSegueWithIdentifier:@"unwindFromvcDetailToVC1" sender:nil];