iOS SDK の Google マップを使用すると、委譲によって MarkerInfoWindow のビューを変更できます。
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker
私の質問は、情報ウィンドウが表示されようとしているときに、情報ウィンドウのポップアップ効果 (ピン別名マーカーではない) をアニメーション化できますか? 私はこの点について手がかりがありません...可能だと思いますが、誰かが私に何かヒントを提供してもらえますか?
ここに私のソースサンプルがあります
@interface BasicMapViewController()
@property (nonatomic, strong) GMSMapView* mapView;
@end
@implementation BasicMapViewController
@synthesize mapView;
- (void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
longitude:151.2086
zoom:9];
CGRect mapRect= CGRectMake(0, 0, 320, 320);
mapView= [GMSMapView mapWithFrame:mapRect camera:camera];
mapView.delegate= self;
[self.view addSubview:mapView];
UIButton* button= [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame= CGRectMake(120, 350, 100, 50);
[button addTarget:self
action:@selector(buttonClicked)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Add Pins" forState:UIControlStateNormal];
[self.view addSubview:button];
}
#pragma mark - button handler
-(void)buttonClicked
{
NSLog(@"clicked");
// Add a custom 'glow' marker around Sydney.
GMSMarker *sydneyMarker = [[GMSMarker alloc] init];
sydneyMarker.icon = [UIImage imageNamed:@"glow-marker"];
sydneyMarker.position = CLLocationCoordinate2DMake(-33.8683, 151.2086);
sydneyMarker.appearAnimation= kGMSMarkerAnimationPop;
sydneyMarker.map = mapView;
GMSMarker *mbourneMarker = [[GMSMarker alloc] init];
mbourneMarker.icon = [UIImage imageNamed:@"glow-marker"];
mbourneMarker.position = CLLocationCoordinate2DMake(-37.814107, 144.963280);
mbourneMarker.appearAnimation= kGMSMarkerAnimationPop;
mbourneMarker.map = mapView;
}
#pragma mark - GMSMapView delegate methods
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
CustomInfoWindow* view = [[[NSBundle mainBundle] loadNibNamed:@"InfoWindowView" owner:self options:nil] objectAtIndex:0];
view.title.text= @"Sydney";
view.subtitle.text= @"Opera House";
return view;
}
-(void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker
{
NSLog(@"info window tapped!");
}
@end