我想在按下 rightcalloutaccessoryview 按钮时添加一个新视图。我目前具有在地图上放置图钉的功能。当我点击图钉时,会加载带有标题、副标题和 V 形的标注 (MKAnnotation)。当我点击 V 形 (rightcalloutaccessoryview) 时,我希望弹出另一个视图,此时显示更多信息。现在,人字形水龙头什么也没做。这就是我所拥有的:
-(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";
}
}
我已经验证了这个动作方法确实会在按下 V 形时被调用。不幸的是,我无法让它拉出一个新的视图。如果有人知道我做错了什么,请告诉我。我有点紧张...
谢谢!
托马斯