简体   繁体   中英

IPhone - Animate from Loading Screen to Main Application View

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.

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

I would just take the UIImageView that you're using for the Default.png image and place it as the topmost subview of your main UI view. In other words, display your main UI right away but with the loading image in front of it. Then, you can animate the loading image out however you like, by changing it's alpha property to 0, for instance, or shrinking it via its transform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM