Friday, January 13, 2012

UIButton with a border

Let's say, you know how to add a button to your application.  Now let's add a border:

This effect should be done the code, for example in -viewDidLoad method:
- (void)viewDidLoad
{
    [super viewDidLoad];
    [[buttonTest layer] setCornerRadius:8.0f];
    [[buttonTest layer] setMasksToBounds:YES];
    [[buttonTest layer] setBorderWidth:3.0f];
}

0 comments:

Post a Comment