Objective c UITextField中的CLLocationDegrees
我有一个UITextField,我想在那里打印我的GPS位置,作为测试,我创建了一个位置:Objective c UITextField中的CLLocationDegrees,objective-c,uitextview,Objective C,Uitextview,我有一个UITextField,我想在那里打印我的GPS位置,作为测试,我创建了一个位置: CLLocationCoordinate2D myPos; myPos.latitude = 38.990603; myPos.longitude= -1.858964; NSLog(@"%f %f", myPos.latitude, myPos.longitude); 这是可行的,但现在,我想向UITextView添加值: self.myUITextField.text = [NSString s
CLLocationCoordinate2D myPos;
myPos.latitude = 38.990603;
myPos.longitude= -1.858964;
NSLog(@"%f %f", myPos.latitude, myPos.longitude);
这是可行的,但现在,我想向UITextView添加值:
self.myUITextField.text = [NSString stringWithFormat:(@"%f %f", myPos.latitude, myPos.longitude)];
这是一个错误:
Sending 'CLLocationDegrees' (aka 'double') to parameter of incompatible type 'NSString *'
如何将CLLOcationDegrees值打印到UITextField中
提前谢谢你括号里的内容可能有点不对劲:
[NSString stringWithFormat:(@"%f %f", myPos.latitude, myPos.longitude)];
应该是:
[NSString stringWithFormat:@"%f %f", myPos.latitude, myPos.longitude];
我必须等待!你跑得真快!