I am getting the values from UITextfield into NSString , need to convert the values of NSString into CGPoint, Suppose if i enter 6,5 into textfield it should covert it into CGPoint.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
由
翻译强力驱动
问题:
回答1:
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.