【发布时间】:2011-03-29 05:22:23
【问题描述】:
我有一个 myClass 类,想访问它的属性 NSArray *currentOptions(特别是获取 currentOptions 的大小并访问我放入其中的 NSStrings。)
我有一个名为 generate options 的方法,它将填充的数组分配给*currentOptions。在我尝试访问*currentOptions 之前调用了生成选项。 myClass 的一个实例也已通过 App 委托添加到 ViewController。但是,当调用 buttonOnePressed 时,我不断收到此错误:
[myClass currentOptions]:无法识别的选择器发送到实例 0x9b10490
这是我的代码部分:
//TClass.h
@interface TClass : NSObject {
NSArray *currentOptions;
}
@property (nonatomic, retain) NSArray *currentOptions;
@end
//viewController
- (IBAction) buttonOnePressed:(id)sender {
NSLog(@"button1 pressed");
NSLog(@"int: %d",[myClass.currentOptions count]);
//myClass here is the instance of TClass
}
【问题讨论】:
标签: iphone objective-c xcode