将MKMapView指向像素坐标

我有一个快速的问题。 我使用自定义视图作为地图视图的标注附件。 我在将注释移动到所述视图的右下angular方面存在一些问题。 我目前正在尝试获取所选注释的CGPoint坐标,但除此之外,我已经绘制了一个空白任何帮助将不胜感激。

我正在使用的当前代码(我知道这是不正确的:)

CGPoint bottomLeftPoint = CGPointMake(xOffset,[self.internalAnnotationCallout view].frame.size.height); CLLocationCoordinate2D bottomLeftCoord = [self.branchLocation convertPoint:bottomLeftPoint toCoordinateFromView:self.branchLocation]; MKCoordinateSpan span = {latitudeDelta: kMapMultiLatDelta, longitudeDelta: kMapMultiLatDelta}; MKCoordinateRegion region = {bottomLeftCoord, span}; [self.branchLocation setRegion:region animated:YES]; //[self.branchLocation setCenterCoordinate:newCenterCoordinate animated:YES]; 

编辑:

好,所以我把这个搞混了,并且能够把一些似乎工作的东西放在一起,希望我现在能够真正理解你要达到的目标!

 - (void)shiftToCorner{ //ignore "Annotation", this is just my own custom MKAnnotation subclass Annotation *currentAnnotation = [[mapView selectedAnnotations] objectAtIndex:0]; [mapView setCenterCoordinate:currentAnnotation.coordinate]; CGPoint fakecenter = CGPointMake(20, 20); CLLocationCoordinate2D coordinate = [mapView convertPoint:fakecenter toCoordinateFromView:mapView]; [mapView setCenterCoordinate:coordinate animated:YES]; } 

让我快速解释这是什么; 假设您要将注释移动到距离地图视图右侧20个点和底部20个点的位置。 如果仔细想想,如果当前注释位于地图视图的中心,那么到这个点的距离与到(20,20)的距离相同。 这意味着我们可以通过首先将我们的地图视图集中在注释上,然后animation到(20,20)来发送我们的注释到这一点。