GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(48.f, 35.f);
marker.map = mapView;
CGPoint point = [mapView.projection pointForCoordinate:marker.position];
为什么点有NaN值?
打印点描述: (CGPoint)point =(x = NaN,y = NaN)
答案 0 :(得分:0)
由于CLLocationCoordinate2DMake
等待float
值,而您发送integer
值。
您可以执行以下操作:
float pointA = (float) (arc4random() % 10);
float pointB = (float) (arc4random() % 10);
marker.position = CLLocationCoordinate2DMake(pointA, pointB);