我目前正在执行 CurrentViewController
中的一个方法,当我到达当前正在执行的方法的结尾
CurrentViewController.m
-(void)methodExecutingOnCurrentViewController
{
//some code..
// what method do I call in order to load and move to my FirstViewController at this point?
// do I first initialize an instance of the ViewController I want to move to?
UIViewController *firstViewController = [[FirstViewController alloc] init];
// but now how do I actually move to this instance I've just created?
// I couldn't find the appropriate method in the class reference documentation
}
看看- (void)presentModalViewControllerUIViewController *)modalViewController animatedBOOL)animated
Doc .
还有许多其他方法可以完成您正在寻找的事情,您是否使用导航 Controller ?然后 - (void)pushViewControllerUIViewController *)viewController animatedBOOL)animated
就是你想要的。您也可以将该 Controller 的 View 作为 subview 添加到当前的 viewController。
关于objective-c - 如何以编程方式移动到另一个 UIViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12272710/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) | Powered by Discuz! X3.4 |