我从UITextfield获取值到NSString,需要将NSString的值转换为CGPoint,假设如果我在文本字段中输入6,5它应该将其转换为CGPoint。
See CGPointFromString (documentation in link). The string has to be in the format {x,y}
so you would need to add those to the user input yourself:
CGPoint myPoint = CGPointFromString([NSString stringWithFormat:@"{%@}",textField.text]);
Will return CGPointZero if the string is invalid.
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.