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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Fading In multiple UIViews at Web Builders.

meta

%d bloggers like this: