0

UITextField があり、GPS 位置をそこに出力したいので、テストとして位置を作成します。

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 に出力するにはどうすればよいですか?

前もって感謝します

4

1 に答える 1

1

括弧はおそらく物事を捨てています:

[NSString stringWithFormat:(@"%f %f", myPos.latitude, myPos.longitude)];

おそらく次のようになります。

[NSString stringWithFormat:@"%f %f", myPos.latitude, myPos.longitude];
于 2012-09-10T07:42:02.823 に答える