开发者

Automate pushviewcontroller

开发者 https://www.devze.com 2023-04-11 03:08 出处:网络
I\'m working on a small app ... and I want to force pushviewcontroller.开发者_开发百科 What I mean is that I want 10 or more viewcontrollers to \"play\" automatic (go on one after another without pres

I'm working on a small app ... and I want to force pushviewcontroller.开发者_开发百科 What I mean is that I want 10 or more viewcontrollers to "play" automatic (go on one after another without pressind any buttons) at a given time interval with a given animation.

I'm not asking for code (but I wouldn't say no to it) ... just a idea, or a link


Who owns the Navigation controller? If it's owned by the appDelegate, you could set up an NSTimer in the appDelegate. It takes a time interval and a selector. The selector could send a pushViewController message.

viewUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 
                                                   target:self 
                                                 selector:@selector(changeDisplay:)
                                                 userInfo:nil
                                                  repeats:YES];

-(void)changeDisplay{
   [self.navController pushViewController:nextcontroller animated:YES];
}


One way is to try with Notification(center). The second is using threads.

You can apply the following steps for both the cases.

  1. When the rootViewController is loaded, in the viewDidLoad detach a thread that will - after a period of time - push viewController1. Similarly go on and on for as many viewControllers you have.
  2. You can add animation or other tasks in the viewDidLoad of the pushed viewController.


Have a look at UICatalog from Apple's official documentation. Pay attention to ImageViewController, as it presents different views with animation.

0

精彩评论

暂无评论...
验证码 换一张
取 消