Fading In multiple UIViews
April 5, 2009 § Leave a comment
Consider to show three views as separate UIViews inside a single XIB, if you plan to display them together. Set their initial alpha values to 0.0. Fade the views using beginAnimations and setAnimationDuration.
[UIView beginAnimations:@"fade" context:nil]; [UIView setAnimationDuration:1.0]; viewOne.alpha = 1.0; viewTwo.alpha = 1.0; viewThree.alpha = 1.0; [UIView commitAnimations]
Normally Apple recommends one XIB per UIViewController/UIView combination. If you place several ViewCOntrollers and Views in the same XIB, they are all loaded at the same time and use up memory for all the elements of the XIB.
If you are just loading subviews, you can construct them in the same xib, or build them programatically in viewDidLoad or viewWillAppear.
The recommended method is to use MainWindow.xib to have proxys to each of the xibs (UIViewController/UIView combos) you plan on loading.