I'm trying to add subview in my ViewController
using this method
- (void)viewDidLoad
{
[super viewDidLoad];
addCourse = [[UIView alloc]init];
addCourse.backgroundColor = [UIColor redColor];
[addCourse.layer setCornerRadius:50.0f];
[addCourse.layer setMasksToBounds:YES];
}
Where addCourse
is my subview
but the background color is still white. and I'm using storyboard
and added the subview
with it and linked the View with viewcontroller
and I did write the IBOutlet and the property and synthesize but still I couldn't find a way to change the background color.
How I can change it ?
If you already linked with the ViewController then you just need to remove the below line from your code
addCourse = [[UIView alloc]init];
Because, it create the new instance of your subView.