简体   繁体   English

在 nstextfield 类型的 object 上找不到属性文本

[英]property text not found on object of type nstextfield

I'm making simple SQLite database for MacOS and use information from this tutorial which is for iOS.我正在为 MacOS 制作简单的 SQLite 数据库,并使用教程中针对 iOS 的信息。

I got an error "property text not found on object of type nstextfield" when I implement these lines of code:当我实现这些代码行时,出现错误“在 object 类型的 nstextfield 上找不到属性文本”:

    NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO CONTACTS 
    (name, address, phone) VALUES (\"%@\", \"%@\", \"%@\")", 
    name.text, address.text, phone.text];

How can I implement this for MacOS?我如何为 MacOS 实现这个?

try to use the stringValue property of the NSTextField (NSControl from which the NSTextField inherits):尝试使用 NSTextField 的stringValue属性(NSTextField 继承自 NSControl):
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSControl_Class/Reference/Reference.html#//apple_ref/occ/cl/NSControl http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSControl_Class/Reference/Reference.html#//apple_ref/occ/cl/NSControl

NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO CONTACTS 
(name, address, phone) VALUES (\"%@\", \"%@\", \"%@\")", 
name.stringValue, address.stringValue, phone.stringValue];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM