我试图在 viewDidLoad 方法中设置视图层次结构,但最后一行出现问题。
UIView *catView = [[UIView alloc] init];
UIImage *image = [UIImage imageNamed:@"lolcat.png"];
UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
[self.view addSubview:imageView];
我试图在 viewDidLoad 方法中设置视图层次结构,但最后一行出现问题。
UIView *catView = [[UIView alloc] init];
UIImage *image = [UIImage imageNamed:@"lolcat.png"];
UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
[self.view addSubview:imageView];
看起来你想改变
[self.view addSubview:imageView];
至
[catView addSubview:imageView];
请参阅https://teamtreehouse.com/forum/programming-a-background-stuck-on-code-challenge