Reputation: 11201
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
}
Upvotes: 4
Views: 7056
Reputation: 2890
Swift 3
self.window?.rootViewController?.present(viewController, animated: true, completion: nil)
Upvotes: 5
Reputation: 5925
You could use:
[[self window].rootViewController presentViewController:login animated:YES completion:nil];
Upvotes: 5