I've tried various methods, which all give me warnings. Such as userName = [NSString stringWithFormat:@"%@", [yournamefield stringValue]];
which just gives me a warning of
'UITextField' may not respond to '-stringValue'
How do i do this?
使用text
属性在文本字段中获取text
NSString *name = yourNameField.text;
使用UITextField
的text
属性:
NSString *userName = yourNameField.text;
Two ways. It is a property and any property value can be accessed like this -
yournamefield.text
[yournamefield text]
怎么样:
userName = [NSString stringWithFormat:@"%@", yournamefield.text];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.