views:

84

answers:

2

Hi,

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 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];
}
+1  A: 

Take a look at the NSObject's performSelector:withObject:afterDelay: method. You should able to specify 3 seconds delay to perform the action.

Nevin
Thanks all for your replies..Please find the edited code above..It gives me a warning...timer may not respond to method..am I doing correct..please let me know..when I tried to run the app a black screen pops up
racharambola
I figured it out..thanks all for your help
racharambola
+1  A: 

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.

hotpaw2
Thanks all for your replies..Please find the edited code above..It gives me a warning...timer may not respond to method..am I doing correct..please let me know..when I tried to run the app a black screen pops up
racharambola