使用2个不同的段来重新调整模态视图

时间:2013-07-23 19:09:01

标签: ios objective-c storyboard

目前我有一个UIBarButton在ViewController 2中显示Done。我通过在Storyboard中定义的segue以模态方式呈现ViewController 1中的ViewController2。我还有另一个ViewController3,它也以模态方式呈现ViewController2。

问题:我如何定义两个不同的segue来将ViewController2模态地重新命名为VC1或VC3?

经过进一步研究,似乎在VC1和VC3中定义unwindToViewController是最好的方法。但是,有没有办法在模态视图展开之前调用IBAction?

@implementation RedViewController

- (IBAction)unwindToRed:(UIStoryboardSegue *)unwindSegue
{
}

@end

ModalView .m

-(IBAction)actionBeforeUnwinding:(id)sender {
}

1 个答案:

答案 0 :(得分:3)

为什么不放弃呈现ViewController?

- (IBAction)unwindToRed:(id)sender
{
    [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}