Graphics Reference
In-Depth Information
views because Interface Builder always clips views in the editing interface. You'll just have
to trust that they do.
Figure 4.1 Two large white views, each containing small red views
Using code, we'll apply a 20-point radius to the corners and enable clipping on only the
second view (see Listing 4.1). Technically, these properties can both be applied directly in
Interface Builder by using User Defined Runtime Attributes and the Clip Subviews
checkbox in the Inspector panel, respectively, but in the example this is implemented in
code for clarity. Figure 4.2 shows the result.
Listing 4.1 Applying cornerRadius and masksToBounds
@interface ViewController ()
@property ( nonatomic , weak ) IBOutlet UIView *layerView1;
@property ( nonatomic , weak ) IBOutlet UIView *layerView2;
@end
@implementation ViewController
- ( void )viewDidLoad
{
Search WWH ::




Custom Search