Keith Adler
Keith Adler

Reputation: 21178

Animate loaded subview

How would I make this code animate in the SplashView NIB instead of just making it appear (e.g. the UIModalTransitionStyleFlipHorizontal style)? I am using a UITabBarController type project.

- (IBAction)showSplash:(id)sender {

// Hide toolbar
self.tabBarController.tabBar.hidden = YES;

// Splash
[[NSBundle mainBundle] loadNibNamed: @"SplashView" owner: self options: nil];
[self.view addSubview: splashView];
[window makeKeyAndVisible];
}

Upvotes: 0

Views: 213

Answers (1)

Jamie
Jamie

Reputation: 5122

Bit hard to tell your context with this small bit of code. Basically, if you want to push a viewController modally, in your -(IBAction)showSplash method (you don't need to send the sender if you're not using it, BTW), I would use some code similar to this:

SplashViewController *svc = [[SplashViewController alloc] init]; (assuming nib is same name)
self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:svc animated:YES];
[svc release];

Then in your SplashViewController you would have an IBAction that calls:

[self dismissModalViewController animated:YES];

You don't actually have to hide the tabBar when you are presenting a modalViewController. It won't be there. The idea of a modalViewController is that it blocks all user interaction with the app except for the modal view, until it is dealt with.

Hope this helps.

Upvotes: 2

Related Questions