简体   繁体   English

一个接一个地呈现UIViewController

[英]Present UIViewController one after another

UIToolbar button on the MainViewController presents UIViewController , now i want to display multiple UIViewControllers one after the other via this button.What is the best way to do this. MainViewController上的UIToolbar按钮显示UIViewController ,现在我想通过此按钮一个接一个地显示多个UIViewControllers

- (void)displayviewsAction:(id)sender
{ 
PageOneViewController *viewController = [[[PageOneViewController alloc] init]autorelease];

viewController.view.frame = CGRectMake(0, 0, 320, 480);

[self.view addSubview:viewController.view];

[self.view addSubview:toolbar];

} 

when button is pressed it displays this UIViewController now right after this UIViewController i want to present multiple UIViewControllers one after the other. 当按下按钮时,它立即在此UIViewController之后显示此UIViewController我想一个接一个地显示多个UIViewControllers

Any ideas please. 有什么想法。

Say you want to display view controllers A,B,C by tapping on main view controller's tool bar button. 假设您要通过点击主视图控制器的工具栏按钮来显示视图控制器A,B,C。 To do so write 为此写

 [self presentModalViewController:a animated:YES];

on button action. 按钮动作。 In A's viewDidAppear: method, write 在A的viewDidAppear:方法中,编写

 [self presentModalViewController:b animated:YES]; 

Writing same for all view controllers will display viewControllers one after another. 为所有视图控制器编写相同的视图控制器将一个接一个地显示。

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

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