Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rounded corners on UIView [duplicate]

I am confused on how I would round corners, I've seen about 10 other posts and non of them have helped me. Am I doing this correctly?

#import "QuartzCore/QuartzCore.h" // in my ViewController.h

- (void)viewDidLoad
{
[super viewDidLoad];

     self.backgroundLayer.cornerRadius = 10.0f;
}

If somebody could help me out on this it'd be greatly appreciated.

like image 431
cthrp Avatar asked Mar 24 '13 08:03

cthrp


1 Answers

Try turning on masksToBounds. Also, what is backgroundLayer?

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.layer.cornerRadius = 10.0f;
    self.view.layer.masksToBounds = YES;
}
like image 118
Sherman Lo Avatar answered Oct 18 '22 00:10

Sherman Lo