UIButton的titleLabel根据上下文无法访问

时间:2013-02-27 03:16:49

标签: ios

在我的一个课程中,我可以运行

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>>

然而,在测试期间,当我尝试访问testButton的titleLabel时,我得到EXC_BAD_ACCESS,即使我使用相同的两行代码。

有什么想法吗?

0 个答案:

没有答案