问这个很尴尬,因为我已经构建应用程序有一段时间了。过去我一直使用 Interface Builder 来设置我的视图等。
这是我的加载视图:
- (void)loadView {
UIView *splashView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
splashView.backgroundColor = [UIColor clearColor];
UIImageView *splashImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[[NSBundle mainBundle]pathForResource:@"splash" ofType:@"jpg"]]];
splashImage.frame = [splashView bounds];
[splashView addSubview:splashImage];
self.view = splashView;
}
由于某种原因,imageView 没有出现。没有错误,只是没有外观。UIView 已添加,但 UIImageView 未添加。
就像我说的,我传统上是用 IB 做的,所以我对编程方法不太熟悉。
任何帮助表示赞赏。