本文介绍了在XIBs iOS之间移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于视图的应用程序,其中包含三个xib文件,每个文件都有自己的视图控制器.如何从一个变为另一个?我使用它从xib 1移到xib 2,但是当我使用相同的代码从xib 2移到xib 1时,我在[self presentModal ....]行上得到了EXC_BAD_ACCESS.

I have a view-based application with three xib files, each with its own view controllers. How do I change from one to another? I use this to move from xib 1 to xib 2, but when I use the same code to move from xib 2 to xib 1, i get a EXC_BAD_ACCESS on the [self presentModal....] line.

MapView *controller = [[MapView alloc] initWithNibName:@"MapView" bundle:nil];

controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

[self presentModalViewController:controller animated:YES];

我如何自由地从一个xib移到另一个?

How can I freely move from one xib to another?

推荐答案

我想您尝试做的是呈现一个模式视图,然后将其关闭,对吗?如果是这种情况,那么您可以将下面的代码放在用来关闭它的方法中(例如-(IBAction)dissmissModalView)

What I think you are trying to do is is present a modal view and then dismiss it, right? If that is the case then you put the code below in the method that you use to dismiss it(e.g. -(IBAction)dissmissModalView)

[self.parentViewController dismissModalViewControllerAnimated:YES];

希望这行得通.让我知道.

Hopefully that works. Let me know.

这篇关于在XIBs iOS之间移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 10:28