I am trying to build a splash screen so I want the 1st View Controller to move to 2nd ViwController automatically after 3.0 sec I have tried the below method but an infinite loop has started what should i do ,how should I stop on second view controller.
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"%p", self);
NSLog(@"1st Controller");
[self.navigationController setNavigationBarHidden:YES animated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self loadingNextView];
});
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)loadingNextView{
LoginViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
[self.navigationController pushViewController:viewController animated:true];
}
//LoginViewController.h
@interface LoginViewController : ViewController
@end
//LoginViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSLog(@"2nd View Controller");
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}