有没有办法轻松实现呢?
解决方法 首先向地图添加注释,并在vIEwForAnnotation方法中,将rightCalloutAccessoryVIEw设置为类型的按钮,例如UIbuttonTypeDetaildisclosure(我不认为蓝色信息按钮默认可用)。按下按钮将调用calloutAccessoryControlTapped委托方法。在此方法中,取消选择注释并显示popover。例如:
- (voID)mapVIEw:(MKMapVIEw *)mapVIEw annotationVIEw:(MKAnnotationVIEw *)vIEw calloutAccessoryControlTapped:(UIControl *)control{ [mapVIEw deselectAnnotation:vIEw.annotation animated:YES]; YourContentVIEwController *ycvc = [[YourContentVIEwController alloc] init... UIPopoverController *poc = [[UIPopoverController alloc] initWithContentVIEwController:ycvc]; [ycvc release]; //hold ref to popover in an ivar self.annotationPopoverController = poc; //size as needed poc.popoverContentSize = CGSizeMake(320,400); //show the popover next to the annotation vIEw (pin) [poc presentPopoverFromrect:vIEw.bounds inVIEw:vIEw permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; [poc release];}
YourContentVIEwController是UIVIEwController的子类,你可以像任何其他视图控制器一样编码。地图应用程序看起来在内容中包含UItableVIEw。
总结以上是内存溢出为你收集整理的ios – 如何将UIPopoverView显示为地图视图的注释? (iPad)全部内容,希望文章能够帮你解决ios – 如何将UIPopoverView显示为地图视图的注释? (iPad)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)