Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何向UIMapView中的管脚添加更多信息_Ios_Mkmapview - Fatal编程技术网

Ios 如何向UIMapView中的管脚添加更多信息

Ios 如何向UIMapView中的管脚添加更多信息,ios,mkmapview,Ios,Mkmapview,我刚开始为iOS开发,我刚刚获得了我的开发帐户,开始着手做更困难的事情。不管怎样,我已经学会了如何添加UIMapView,如何让它在不同的视图之间切换,以及如何用标题和子标题设置pin,但是我想让它成为这样,当你看到pin下降时,你会看到标题,然后在左边有一个小箭头,你点击它,它会带你进入一个页面,页面上有更多信息,比如如何点击按钮您点击该按钮可进入“地图”应用程序,并为您指明位置,或者您可以在页面中获得更多信息。基本上,当你搜索一个位置并弹出一堆时,它在iOS上的地图应用程序中的外观。因此,我

我刚开始为iOS开发,我刚刚获得了我的开发帐户,开始着手做更困难的事情。不管怎样,我已经学会了如何添加UIMapView,如何让它在不同的视图之间切换,以及如何用标题和子标题设置pin,但是我想让它成为这样,当你看到pin下降时,你会看到标题,然后在左边有一个小箭头,你点击它,它会带你进入一个页面,页面上有更多信息,比如如何点击按钮您点击该按钮可进入“地图”应用程序,并为您指明位置,或者您可以在页面中获得更多信息。基本上,当你搜索一个位置并弹出一堆时,它在iOS上的地图应用程序中的外观。因此,我的总体问题是如何在地图视图的下拉框中添加更多信息选项卡?

这可以在地图视图的帮助下实现,注意:委托方法。您只需创建一个按钮,并将其指定为rightCalloutAccessoryView。下面给出了一个示例代码

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
    MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
    annView.pinColor = MKPinAnnotationColorGreen;

    UIButton *advertButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    advertButton.frame = CGRectMake(0, 0, 23, 23);
    advertButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    advertButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;

    //[advertButton setImage:[UIImage imageNamed:@"button_right.png"] forState:UIControlStateNormal];
    [advertButton addTarget:self action:@selector(showLinks:) forControlEvents:UIControlEventTouchUpInside];

    annView.rightCalloutAccessoryView = advertButton;

    annView.animatesDrop=TRUE;
    annView.canShowCallout = YES;
    annView.calloutOffset = CGPointMake(-5, 5);
    return annView;
}

@普里坦:是的,当然。为什么不呢?查找IOS版谷歌地图SDK的链接no.苹果不会拒绝使用谷歌地图SDK的应用程序。这是一个例子,让我们来看看
-(void)showLinks:(UIButton*)sender  {
     //do the stuffs for navigation

}