「myLocation」ボタンがタップされたときに何かをしたいです。これまでのところ、私はUIButton
それ自体を持っています:
UIButton *btnMyLoc = (UIButton*)[self.googleMapView subviews].lastObject;
しかし、それだけでは十分ではありません。何か案は?
「myLocation」ボタンがタップされたときに何かをしたいです。これまでのところ、私はUIButton
それ自体を持っています:
UIButton *btnMyLoc = (UIButton*)[self.googleMapView subviews].lastObject;
しかし、それだけでは十分ではありません。何か案は?
リリース 1.9.2 には、まさにそれを行うデリゲート メソッドがあります。
(BOOL) didTapMyLocationButtonForMapView: (GMSMapView *) mapView [optional]
他のことを行うには、場所ボタンへの参照も取得できます。
// custom target My Location Button
for (UIView* tmpview in _mapView.subviews[1].subviews[0].subviews) {
if ([NSStringFromClass([[tmpview class] class]) isEqualToString:@"GMSx_QTMButton"]) {
if ([tmpview isKindOfClass:[UIButton class]]) {
myLocationBtn = (UIButton*)tmpview;
[myLocationBtn addTarget:self action:@selector(clickedOnLocationButton:) forControlEvents:UIControlEventTouchUpInside];
}
}
}