문제

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];
}
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top