2010-12-14 35 views
1

m想通了解如何設置我的谷歌地圖標記的視口。在iphone中自定義googlemap視口

有沒有辦法在objC中做到這一點?

或我必須在我的地圖本身做?如果是的話,那麼如何?

我對谷歌地圖的代碼只是顯示的地圖與標記一起,但是當我點擊它,它只是顯示在一個小盒子的地方的名字.. :(

如何使它合適這裏視???

是視圖像: alt text

回答

1

1)您也可以繼承MKAnnotationView。我認爲這是解決問題的最好方法。

2)您可以自定義註釋標註視圖,例如:

- (MKAnnotationView *) mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation { 
    static NSString* ItemAnnotationIdentifier = @"itemAnnotationIdentifier"; 
    MKPinAnnotationView* pinView = (MKPinAnnotationView *) 
            [theMapView dequeueReusableAnnotationViewWithIdentifier:ItemAnnotationIdentifier]; 
    if (!pinView) 
    { 
     // if an existing pin view was not available, create one 
     MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc] 
              initWithAnnotation:annotation 
              reuseIdentifier:ItemAnnotationIdentifier] 
              autorelease]; 
     customPinView.canShowCallout = YES; 

     UIImage *logo = [ImageProcessor scaleImage:[UIImage imageNamed:@"logo.png"] toSize:CGSizeMake(30, 30)]; 
     customPinView.leftCalloutAccessoryView = [[[UIImageView alloc] initWithImage:logo] autorelease]; 

     UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
     rightButton.tag = [((ItemAnnotation *)annotation).itemId intValue]; 
     [rightButton addTarget:self 
         action:@selector(showDetails:) 
      forControlEvents:UIControlEventTouchUpInside]; 
     customPinView.rightCalloutAccessoryView = rightButton;  

     return customPinView; 
    } 
    else 
    { 
     pinView.annotation = annotation; 
    } 
    return pinView; 
} 
+0

我問生根粉的GoogleMaps ...... 反正我已經實現你的理念,我得到它.. :) 感謝。 .. :) – Hisenberg 2010-12-16 08:03:32

+0

歡迎:) – knuku 2010-12-16 08:35:31