我正在使用以下代码来显示Google地图中当前位置的图钉。但是当我点击按钮显示图钉时,第一次图钉没有显示但是当我第二次点击它时会显示图钉。 请建议我替代:
UIButton *myDetailButton = [UIButton buttonWithType:UIButtonTypeCustom];
//UIButton *myDetailButton = [UIButton buttonWithType:UITableViewCellAccessoryDetailDisclosureButton];
myDetailButton.frame = CGRectMake(0, 0, 23, 23);
myDetailButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
myDetailButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
myDetailButton.tag = tag;
tag++;
//[myDetailButton addTarget:self action:@selector(gotoBusinessDetail:) forControlEvents:UIControlEventTouchUpInside];
// Set the button as the callout view
currentMarkerAnnotationView.rightCalloutAccessoryView = myDetailButton;
currentMarkerAnnotationView.image = [UIImage imageNamed:@"redmarker.png"];
currentMarkerAnnotationView.canShowCallout = NO;
return currentMarkerAnnotationView;