小编Ter*_*oto的帖子

UIView不显示addSubview

我描述了[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)

你有什么解决办法?

objective-c uiview ios

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×1

objective-c ×1

uiview ×1