我UIView
使用这样的 NIB 文件的内容创建了一个对象:
self.results = [[[NSBundle mainBundle] loadNibNamed:@"ResultsView" owner:self options:nil] lastObject];
self.results.frame = CGRectMake(0, 0, 320, 500);
但实际上self.results
是一个子类UIView
:
@interface GameResultsView : UIView {
UILabel *title;
}
@property (nonatomic, retain) IBOutlet UILabel *title;
@end
我已通过 Interface Buildertitle
将定义的属性GameResults
与对象连接起来。UILabel
但是在执行过程中,SIGABRT
当视图被分配给时,应用程序会停止并显示一条消息self.results
:
-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x4c2f780
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x4c2f780'
似乎标签根本无法连接。这样做的正确方法是什么(如果有的话)?我的目的是将此自定义视图添加到UIScrollView
对象中。
谢谢!
更新:我正在使用 Xcode 4