我已经创建了UIView的子类,并且在init方法中我有这个代码会产生错误
_blackBackground = [[UIView alloc] initWithFrame:self.frame];
_blackBackground.backgroundColor = [UIColor blackColor];
[_blackBackground setAlpha:0];
[self addSubview:_blackBackground];
NSLog(@"1");
_window = [[UIImageView alloc] initWithFrame:CGRectMake(512 - 250, 768 + 50, 500, 650)]; // just below the screen by 50px
NSLog(@"2");
[_window setImage:[UIImage imageNamed:@"Buy Window Background.png"]];
NSLog(@"3");
[self addSubview:_window]; //error on this line
NSLog(@"4");
错误说:
* 由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [UIImageView _subtreeMonitorsForView:]:无法识别的选择器发送到实例0x7db5f60'
我已经检查了图片标题名称是否正确