I wanted to programmatically add myView
to parent view. But it doesn't show up on screen. What's wrong with the code?
@interface ViewController ()
@property (nonatomic,weak) UIView *myView;
@end
@implementation ViewController
@synthesize myView = _myView;
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect viewRect = CGRectMake(10, 10, 100, 100);
self.myView = [[UIView alloc] initWithFrame:viewRect];
self.myView.backgroundColor = [UIColor redColor];
[self.view addSubview:self.myView];
}