Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Present a view controller from appdelegate

I am not using LaunchScreen.xib . I am using storyboard for splashscreen. I am calling an API to get the splash image . I am doing this in app delegate. I am able to display the image on my view controller,but I couldnt able to go to another controller once i display my image.

Here is what I have in AppDelegate:

-(void)connectionDidFinishLoading:(NSURLConnection *)connection{


self.window.frame=CGRectMake(0, 200, 100,30);

[self.window addSubview:[self convertImage: image]];

//upto here everything is fine

//now i am trying to wait for 3 seconds and call another view controller

sleep(3);

ViewController *login=[[ViewController alloc]initWithNibName:@"Login" bundle:nil];
[self presentviewcontroller:....]; // not able to present another controller

}
like image 264
Teja Nandamuri Avatar asked Feb 10 '23 22:02

Teja Nandamuri


1 Answers

You could use:

[[self window].rootViewController presentViewController:login animated:YES completion:nil];
like image 175
Aseider Avatar answered Feb 23 '23 04:02

Aseider