IPhone – Animate from Loading Screen to Main Application View

animationcocoa-touchiphoneuikituiview

I have an IPhone application that I want to attempt login and do some initial setup before showing the UI. I currently have my Default.png set to an image and I have a view that has that same image. When my app loads the Default.png loads and then my loading screen loads. The loading screen is the view for my root view controller in the MainWindow.xib. After loading my app will show a tab bar controller that is created programmatically in the root view controller.

I want to be able to animate between the loading view ( which is defined in MainWindow.xib) and my tab bar controller ( defined in the root view controller ). I am just doing

self.view = tabBarController.view;

to switch views. I have noticed that that doesn't work when wrapped with UIView animations. My question is how should I be switching views. I tried addSubView and insertViewAtIndex and these both do the animation, but leave the 20px status bar gap at the top of the screen ( underneath the already existing status bar ). I assume there is something simple, but I'm not sure what it is.

Best Answer

You should not do self.view=tabController.view...what type of animation do you want? Have you considered using a NavigationViewController ? pushing to the NavigationController s tack will allow you to animate the transitions (pushing the new view in). Other options you have without using a navigation view controller is using presentModalView:animated method in UIViewController, you can also define your animations when using addSubview, the metronome example project in the apple site shows how to go about it when y ou click the info button heres a link https://developer.apple.com/iphone/library/samplecode/Metronome/ . hope this helps