我一直在按照“学习目标-C开发iPhone游戏”一书的方式向外国人入侵者发出指示。
我在.m
文件中输入了以下代码,然后该书告诉我运行以下代码:
@interface GameViewController ()
@property (strong) UIImage *playerImage;
@property (strong) UIImageView *playerView;
@end
@implementation GameViewController
- (void)viewDidLoad {
[super viewDidLoad];
//Assign an image to a variable
self.playerImage = [UIImage imageNamed:@"ship.png"];
//Create an image view and start it up with out image
self.playerView = [[UIImageView alloc] initWithImage: self.playerImage];
//Set the image views bounding rectangle to scale the image.
self.playerView.frame = CGRectMake(50,400, 32,32);
//Show the image on the screen.
[self.view addSubview: self.playerView];
}
}
我尝试在模拟器中运行代码,但是会发生以下错误。为什么会这样?
Alien-Invaders[565:10012] Could not load the "backdrop.png" image referenced from a nib in the bundle with identifier "Chris.Alien-Invaders"