위도 및 경도 값을 전달하는 방법은 CLLocation Manager에서 내 CustomView로 전달합니다. 나는 위치를 받고, 나는 내가 CGPoint latLong = {41.998035, -116.012215} 정적 툭 한 내가CLLocationManager에서 위치를 전달하는 방법
#define EARTH_RADIUS 6371
- (void)drawRect:(CGRect)rect
{
CGPoint latLong = {41.998035, -116.012215};
CGPoint newCoord = [self convertLatLongCoord:latLong];
NSLog(@"Cartesian Coordinate: (%f, %f)",newCoord.x, newCoord.y);
//Draw dot at coordinate
CGColorRef darkColor = [[UIColor colorWithRed:21.0/255.0
green:92.0/255.0
blue:136.0/255.0
alpha:1.0] CGColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, darkColor);
CGContextFillRect(context, CGRectMake(newCoord.x, newCoord.y, 100, 100));
}
-(CGPoint)convertLatLongCoord:(CGPoint)latLong
{
CGFloat x = EARTH_RADIUS * cos(latLong.x) * cos(latLong.y);
CGFloat y = EARTH_RADIUS * cos(latLong.x) * sin(latLong.y);
return CGPointMake(x, y);
}
로 좌표로보기를 분할 한의 drawRect 또 다른 UIView의 클래스가 스피 CLLocationManger와 함께의 ViewController 있습니다.
당신은 UIView의 클래스에의 ViewController 값을 전달하는 방법을 나에게 말할 수
장치가 이동함에 따라 위치를 업데이트하고 싶습니다. 그지도없이. –
@ rajesh.k - 이해하지만, 'convertLatLongCoord'는 당신이 생각하는대로 달성 할 것이라고 생각하지 않습니다. 그것으로 놀아 라. 그러면 나는 당신이 의미하는 것을 볼 것이다. – Rob
이것을 확인하십시오.지도가없는 보트를 찾고 싶습니다. https://play.google.com/store/apps/details?id=com.terboel.myanchorwatch –