I have this and it works:
[pole insertObject: [NSString stringWithFormat:@"%s",[textfield text]] atIndex:idpole];
But this doesn't save to string what is in the texfield, but some numbers or other unspecified characters. What can I do, to save real text from a textfield?
There is no need to create a new string:
[pole insertObject: [textfield text] atIndex:idpole];
Or if you want to make sure the the string a new object:
[pole insertObject: [NSString stringWithString:[textfield text]] atIndex:idpole];
尝试:
[pole insertObject:[textfield text] atIndex:idpole];
Thats because [textfield text] is a reference to a NSString object.
[pole insertObject: [NSString stringWithFormat:@"%@",[textfield text]] atIndex:idpole];
NSlog(@"%@",pole);
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.