Display and Interaction Traits

In addition to physical screen layout, the UIView class provides properties that control how your view appears and whether users can interact with it. Every view uses an opaqueness factor (alpha) that ranges between opaque and transparent. Adjust this by issuing [myView setAlpha:value] or setting the myView.alpha property where the alpha values fall between 0.0 (fully transparent) and 1.0 (fully opaque). This is a great way to fade views in and out. Use the hidden property to hide views entirely without animation.

You can assign a color to the background of any view. For example, the following property colors your view red:

myView.backgroundColor = [UIColor redColor];

This property ...

Get The Core iOS Developer’s Cookbook, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.