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