UIActivity Indicator- load views
I am trying to add some titles to my project. So, when my app gets loaded it should show my title screen with activity indicator spinning and after 3seconds it should push the navigation controller. Basically I will have an image on the first view controller. So, in IB I added an image view and set the image. Please help me guys how to load second view controller after the first view controller gets loaded..
Basically please tell me how to push navigation 开发者_Python百科controller after particular time delay without any buttons or any other controls in it..
Thanks for all your time..
EDIT
- (void)viewDidLoad {
[super viewDidLoad];
[indicator startAnimating];
timer=[NSTimer scheduledTimerWithTimeInterval: 3.0 target:self selector:@selector(loadNextView) userInfo:nil repeats: YES];
}
-(void)loadNextView
{
TabBarControllers *tabBar=[[TabBarControllers alloc]initWithNibName:@"TabBarControllers" bundle:nil];
[self.navigationController pushViewController:tabBar animated:YES];
[indicator stopAnimating];
}
There's also lots of iPhone example code that uses an NSTimer to call any method on any object after a specified delay. Just create a method to stop the activity indicator and push your next controller, and call that method via a 3 second NSTimer after starting the activity indicator in your first view.
Take a look at the NSObject's performSelector:withObject:afterDelay: method. You should able to specify 3 seconds delay to perform the action.
精彩评论