简体   繁体   English

是否可以使用PerformSegueWithIdentifier并使发件人成为另一个viewcontroller

[英]Is it possible to PerformSegueWithIdentifier and make the sender a different viewcontroller

Not sure it is possible but I want to 不确定它是否可能,但我想

 [self performSegueWithIdentifier:@"ToAController" sender:SomeOtherViewController];

I may not be doing this even close to right but I would like to do this so my navigation flow works correctly (as in doesnt go back to "ToAController" but instead would go back to "SomeOtherViewController) 我可能不会这样做甚至接近右边,但我想这样做,所以我的导航流程正常工作(如不回到“ToAController”,但反过来会回到“SomeOtherViewController”)

EDIT 编辑

For clarification of my navigation flow 为了澄清我的导航流程

the letters and numbers are views 字母和数字是视图

1->2 1-> 2

1->A->2 1-> A-> 2

1<-2 1 <-2

B<-2 乙<-2

1<-A 1 <-A

I dont want anything to go back (have a back button to 'A' 我不想要任何东西回去(有一个后退按钮'A'

The sender can be any kind of object, the sender will be received in the - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender method of the view controller that calls the performSegue method. 发件人可以是任何类型的对象,发件人将收到- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender调用performSegue方法的视图控制器的- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender方法。

Another thing I don't know what you try to say by go back but if you want to go back to a view controller that is already added in the navigationController stack then you should use the pop methods of the UINavigationController instead of segues because a segue will perform only push/modal/custom operations which will add the destinationController to the UINavigation controller stack. 另一件事我不知道你想说什么回去但如果你想回到一个已经添加到navigationController堆栈中的视图控制器那么你应该使用UINavigationController的pop方法而不是segues因为一个segue将只执行push / modal / custom操作,将destinationController添加到UINavigation控制器堆栈。

EDIT 编辑

Form iOS 6 there is a new type of segue called unwind that can be linked to the green Exit icon of a View Controller in storyboard. 在iOS 6表格中有一种称为展开的新型segue,可以链接到故事板中View Controller的绿色Exit图标。 And because I don't want to steal votes from other beloved SO members here is a good thread regarding unwind segues What are Unwind segues for and how do you use them? 而且因为我不想从其他心爱的SO成员那里窃取选票,所以这是一个关于放松赛段的好线程什么是Unwind segues for how以及如何使用它们?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM