我描述了[self.view addSubView:myView];,
但myView没有显示self.view.
ViewController.h
@interface ViewController : UIViewController{
UIView *myView;
}
@property (nonatomic, strong) UIView *myView;
Run Code Online (Sandbox Code Playgroud)
ViewController.m
@synthesize myView;
- (void)viewDidLoad
{
[super viewDidLoad];
myView.frame = CGRectMake(-10, 70, 320, 480);
[self.view addSubview:myView];
myView.backgroundColor = [UIColor redColor];
[self.view bringSubviewToFront:myView];
}
Run Code Online (Sandbox Code Playgroud)
你有什么解决办法?