相关疑难解决方法(0)

使用MapKit框架在谷歌地图上绘制多边形

我想在地图视图中显示Google地图,我想在其中绘制多边形/圆形.

有什么建议?

objective-c mapkit ios

5
推荐指数
2
解决办法
5838
查看次数

无法将MapKit用户坐标转换为屏幕坐标

好的,这实际上是一个线程中的三个不同的问题:

1)我正在使用:

- (void)viewDidLoad
{
    [super viewDidLoad];
    [mapView setFrame :CGRectMake(-100,-100,520,520)];
    [mapView setAutoresizesSubviews:true];
    mapView.showsUserLocation = YES;

    locManager = [[CLLocationManager alloc] init];
    locManager.delegate = self;
    [locManager startUpdatingLocation];
    [locManager startUpdatingHeading];

    [bt_toolbar setEnabled:YES];
}


- (IBAction) CreatePicture
{
     CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(mapView.userLocation.coordinate.latitude, mapView.userLocation.coordinate.longitude);

     CGPoint annPoint = [self.mapView convertCoordinate:coord toPointToView:self.mapView];    
     mapPic = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pic.png"]];
     mapPic.frame = CGRectMake(annPoint.x, annPoint.y, 32, 32);
     [self.view addSubview:macPic];
}
Run Code Online (Sandbox Code Playgroud)

使用GCRectMake在用户的坐标上放置图像,但遗憾的是图像没有放在正确的位置:

协调转换出错了

如果我移动地图,图片将始终放置与用户位置完全相同的偏移量.我错过了什么?它不应该直接放在用户上方吗?我猜测偏移量(-100,-100)我首先给出了mapView是导致这种情况的原因(我在下方有一个工具栏,因此偏移).

2)我的iOS 5模拟器表现得很疯狂,把我的位置放在凤凰城的格伦代尔(不应该是在Cupertino吗?)出于某种原因,并且因为我正在向东移动; 我的iPhone 4一切正常(除了不正确的图片放置).有任何想法吗?

3)我一直在考虑使用Annotations,但我听说它们是静态的(我真的需要它们是动态的).这是真的?

谢谢!

iphone mapkit ios ios-simulator ios5

3
推荐指数
1
解决办法
2890
查看次数

标签 统计

ios ×2

mapkit ×2

ios-simulator ×1

ios5 ×1

iphone ×1

objective-c ×1