在我的一门课上,我可以跑
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeCustom];
NSLog(@"testButton's titleLabel is %@", testButton.titleLabel);
它打印 titleLabel 就好了:
2013-02-26 19:11:49.223 Facebook[82876:c07] testButton's titleLabel is <UIButtonLabel: 0x1aad39f0; frame = (0 0; 0 0); clipsToBounds = YES; hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x1aad3a90>>
然而,在测试期间的一个类中,EXC_BAD_ACCESS
当我尝试访问 testButton 的 titleLabel 时,即使我使用的是相同的两行代码。
有任何想法吗?