我感觉我在这里碰壁了(而且坦率地说,我已经准备好这样做了)。
我想要将视图的背景设置为一张图片,我正在使用这段代码(在其他两个UIViewController子类中完美运行 - 这是一个复制/粘贴到新文件中的过程):
UIImage *img = [gameNode imageFromKey:@"background"];
UIColor *bg = [[UIColor alloc] initWithPatternImage:img];
self.view.backgroundColor = bg;
[bg release];
正如我所说的,在另外两个地方这个很好地运行,但是在这里,第self.view.backgroundColor = bg
行抛出异常。
'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x9259840'
这里没有更多的信息可以参考。我在 Interface Builder 中验证了顶层视图的引用出口已设置为文件的所有者。我清理了项目并重新启动了。我甚至关闭了 Xcode 并再次启动它 - 但没有运气。我还错过了什么?
编辑:正如我所提到的,堆栈跟踪中没有更多的信息,只有这些:
2012-05-28 13:13:56.997 OOKL[36012:17303] -[UILabel copyWithZone:]: unrecognized selector sent to instance 0x92b79a0
2012-05-28 13:13:56.997 OOKL[36012:17303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector sent to instance 0x92b79a0'
*** First throw call stack:
(0x2933052 0x44c7d0a 0x2934ced 0x2899f00 0x2899ce2 0x2935bd9 0xaa92dd 0x6a4f40 0x6a4eeb 0x6bfd60 0xc0191a 0x2934e1a 0x289e821 0xc0046e 0xaa7e2c 0xaa83a9 0xaa85cb 0xb2b59 0xb1969 0x2934ec9 0x9e55c2 0x9e555a 0xa8ab76 0xa8b03f 0xa8a2fe 0xa0aa30 0xa0ac56 0x9f1384 0x9e4aa9 0x2ac6fa9 0x29071c5 0x286c022 0x286a90a 0x2869db4 0x2869ccb 0x2ac5879 0x2ac593e 0x9e2a9b 0x214d 0x20c5)
仅此而已-之前或之后都没有。