IBOutlet未宣布

时间:2013-01-27 04:41:20

标签: macos interface-builder nstextfield iboutlet

我正在编写一个Mac应用程序,我有一个文本字段,其内容我想更新。在Interface Builder中,我控制 - 将我的文本字段拖动到AppDelegate.h中,后者创建了行

@property (unsafe_unretained) IBOutlet NSTextField *cStatus;

现在在我的AppDelegate.m中我想编辑状态,在以下函数中:

static void Handle_DeviceMatchingCallback(void *inContext, IOReturn inResult, void *inSender, IOHIDDeviceRef inIOHIDDeviceRef){
   NSLog(@"\nDevice added: %p\nDevice count: %ld", (void*)inIOHIDDeviceRef, USBDeviceCount(inSender));
   [cStatus setString:@"Connected"];
}

但这给了我错误“使用未声明的变量cStatus”。我对XCode,InterfaceBuilder和Objective C很新,我如何引用这个文本字段?感谢。

1 个答案:

答案 0 :(得分:2)

cStatus属性,请尝试:

[self.cStatus setString:@"Connected"];