現在、UIView のサブクラスである StationCalloutView があります (xib を使用)。また、MKAnnotation である Station と、MKAnnotationView のサブクラスである StationAnnotationView もあります。
StationAnnotationView で StationCalloutView を開くには、次のようにします。
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
[super setSelected:selected animated:animated];
if (selected) {
self.calloutView = [[StationCalloutView alloc] initWithStation:self.annotation];
if (currentLocation) [self.calloutView calculateDistanceFromLocation:currentLocation];
[self.calloutView setOrigin:CGPointMake(-self.calloutView.frame.size.width/5.5, -self.calloutView.frame.size.height)];
[self animateCalloutAppearance];
[self addSubview:self.calloutView];
} else {
[self.calloutView removeFromSuperview];
}
}
それは完全に機能しますが、StationCalloutView にボタンを追加したいのですが、AnnotationView をクリックすると自動的に選択が解除され、StationCalloutView にタッチが渡されません。
誰もこれを達成する方法について考えを持っていますか?