0
正如您在下面看到的,我使用calloutaccessorycontrol的座標來在我的mapview上放置另一個視圖。然而。它似乎永遠不會將控制放在calloutaccessory控制附近的任何地方。這很奇怪,因爲我正在使用它的x和y座標。正確的標註按鈕的X和Y座標不能準確地放置我的視圖
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
HotelInformationViewController *vc =
[[HotelInformationViewController alloc]initWithNibName:@"HotelInformationViewController"
bundle:nil control:control];
[self.view addSubview:vc.view];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil control:(UIControl *)control
{
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
{
self.view.bounds = CGRectMake(control.frame.origin.x, control.frame.origin.y, 286, 286); //As you can see here I am using the x and y to place the new control
}
return self;
}