Iphone 按右Callout AccessoryView按钮添加新视图

Iphone 按右Callout AccessoryView按钮添加新视图,iphone,objective-c,mapkit,mkannotation,Iphone,Objective C,Mapkit,Mkannotation,我想在右Callout AccessoryView按钮上添加新视图。我目前拥有在地图上放置pin的功能。当我点击插针时,将加载带有标题、副标题和V形文字的标注(MKAnnotation)。当我点击V形按钮(rightcalloutaccessoryview)时,我希望弹出另一个视图,显示此时的更多信息。现在,V形水龙头没有任何作用。这就是我所拥有的: -(IBAction)showInfo:(id)sender { int calloutButtonPressed = ((

我想在右Callout AccessoryView按钮上添加新视图。我目前拥有在地图上放置pin的功能。当我点击插针时,将加载带有标题、副标题和V形文字的标注(MKAnnotation)。当我点击V形按钮(rightcalloutaccessoryview)时,我希望弹出另一个视图,显示此时的更多信息。现在,V形水龙头没有任何作用。这就是我所拥有的:

-(IBAction)showInfo:(id)sender 
{     
     int calloutButtonPressed = ((UIButton *)sender).tag;
     if(calloutButtonPressed < 99999)
     {
          if(self.DetailView == nil)
          {
               DetailViewController *tmpViewController = [[UIViewController alloc] initWithNibName:@"DetailView" bundle:nil];
               self.DetailView = tmpViewController;
               [tmpViewController release];
          }

          if (calloutButtonPressed == 1) 
          {
                         // Using the debugger, I found that calloutButtonPressed is equal to 0 when the button is pressed.
                         // So I'm not sure what the point of this method is...
                }
          self.DetailView.title = @"Title";
     }
 }
-(iAction)showInfo:(id)发件人
{     
int calloutButtonPressed=((UIButton*)sender.tag;
如果(按钮按下<99999)
{
if(self.DetailView==nil)
{
DetailViewController*tmpViewController=[[UIViewController alloc]initWithNibName:@“DetailView”捆绑包:nil];
self.DetailView=tmpViewController;
[tmpViewController释放];
}
如果(Callout按钮按下==1)
{
//使用调试器,我发现按下按钮时calloutButtonPressed等于0。
//所以我不确定这个方法的意义是什么。。。
}
self.DetailView.title=@“title”;
}
}
我已经验证了在按下V形按钮时确实会调用此操作方法。不幸的是,我无法让它打开一个新的视图。如果有人知道我做错了什么,请告诉我。我手头有点紧

谢谢

托马斯

我想找到另一种方法,这样我就不必有那个神奇的数字(99999)(另外,它似乎有点不成熟…)。我不太担心它,因为它是有效的

我从苹果开发者论坛得到了帮助

    -(IBAction)showInfo:(id)sender 
{   
     int calloutButtonPressed = ((UIButton *)sender).tag;
     if(calloutButtonPressed < 99999)
     {
          if(self.detailView == nil)
          {
               DetailViewController *tmpViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
               self.detailView = tmpViewController;
               [tmpViewController release];
          }

          [self.navigationController pushViewController:self.detailView animated:YES];

          if (calloutButtonPressed == 0) 
          {
               // TRP - I inserted my view atIndex:99999 to ensure that it gets placed in front of all windows
               // TODO: figure a better way to do this
               [self.view insertSubview:detailView.view atIndex:99999];
          }
          self.detailView.title = @"Title";
     }

}
[self.view insertSubview:detailView.view atIndex:99999];