Graphics Reference
In-Depth Information
Figure 5.19 The six cube face views laid out in Interface Builder
The face views are not placed inside the main view but have been arranged loosely in the
root of the nib file. We don't care about setting the location of these views within their
container as we are going to position them programmatically using the layer transform ,
and it's useful to place them outside of the container view in Interface Builder so that we
can easily see their contents. If they all were crammed on top of one another inside the
main view, this would be awkward.
We've placed a colored UILabel inside each of the views so we can easily identify which
is which. Note also the UIButton placed in the third face view; this is explained shortly.
Listing 5.9 shows the code to arrange the views in a cube, and Figure 5.20 shows the result.
Listing 5.9 Creating a Cube
@interface ViewController ()
@property ( nonatomic , weak ) IBOutlet UIView *containerView;
@property ( nonatomic , strong ) IBOutletCollection ( UIView ) NSArray *faces;
@end
Search WWH ::




Custom Search