Different transition on presentModalViewController:animated:
I present a modal view controller which is a tab bar controller with a navigation controller inside it.
The problem is my first view has a black background and I want the new view to have a white background.
This means I either have to have the modal view controller with a transparent background (until its completed the "slide up" animation when it shows the white background) OR I have to set the navigation controller background as white in order to make it non-transparent.
This results in me having an extra strip of white ABOVE the navigation开发者_JS百科 bar (where the network status/battery status/time bar goes). I can't get rid of this. :(
So if I could flip the view in, or fade it in, or slide it from the right or the left or something that would be much better asthetically.
Is there any way to do this? Or will I just have to set "animated:" to NO?
Thanks
I did not understand what your plight with the different color backgrounds is about. Opaque backgrounds on your views, especially animating ones, make the app run faster. Now about transitions, before you call presentModalViewController, insert one of the following lines:
modelViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
modelViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
modelViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
modelViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
Any of the above will change the transition style (though the PartialCurl will result in a white bit of the last view still present in the top corner; it seems to be undocumented, though it's used by the Maps app). You may have to play with what the modalTransitionStyle gets set on.
Sliding in from the left or right is part of the navigation controller. Changing backgrounds is probably not what you want when working with the navigation controller.
Also, that extra strip above the model view is going to show up no matter which way you transition in. It's annoying, but it can be over come as follows:
- (void)viewDidLoad {
[super viewDidLoad];
navigationController.view.frame = CGRectMake(0, 0, 320, 460); //<--This line
}
精彩评论