有关如何使用ui控件实现此自定义标注的任何想法?
编辑:这是我的代码来自类似的StackOverflow答案:
- (MKAnnotationVIEw *)mapVIEw:(MKMapVIEw *)mapvIEw vIEwForAnnotation:(ID <MKAnnotation>)annotation{ if ([annotation isKindOfClass:[MKUserLocation class]]) return nil; static Nsstring* AnnotationIDentifIEr = @"AnnotationIDentifIEr"; MKAnnotationVIEw *annotationVIEw = [mapVIEw dequeueReusableAnnotationVIEwWithIDentifIEr:AnnotationIDentifIEr]; if(annotationVIEw) return annotationVIEw; else { UIImage *img = [UIImage imagenamed:@"default_thumb.png"]; MKAnnotationVIEw *annotationVIEw = [[MKAnnotationVIEw alloc] initWithAnnotation:annotation reuseIDentifIEr:AnnotationIDentifIEr]; annotationVIEw.canShowCallout = YES; annotationVIEw.image = img; annotationVIEw.draggable = YES; /* // change left accessory vIEw button with image UIImageVIEw *leftAccVIEw = [[UIImageVIEw alloc] initWithImage:img]; annotationVIEw.leftCalloutAccessoryVIEw = leftAccVIEw; //include a right button to show more info UIbutton* rightbutton = [UIbutton buttonWithType:UIbuttonTypeDetaildisclosure]; [rightbutton addTarget:self action:@selector(calloutSubMenu:) forControlEvents:UIControlEventtouchUpInsIDe]; [rightbutton setTitle:annotation.Title forState:UIControlStatenormal]; annotationVIEw.rightCalloutAccessoryVIEw = rightbutton; */ return annotationVIEw; } return nil;}// Customize accessory vIEw- (voID)mapVIEw:(MKMapVIEw *)mapvIEw annotationVIEw:(MKAnnotationVIEw *)vIEw calloutAccessoryControlTapped:(UIControl *)control{ [mapvIEw deselectAnnotation:vIEw.annotation animated:YES]; PopOverCallout *popOverCallout = [[PopOverCallout alloc]init]; UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentVIEwController:popOverCallout]; self.annotationPopoverController = popOver; popOver.popoverContentSize = CGSizeMake(500,500); [popOver presentPopoverFromrect:vIEw.bounds inVIEw:vIEw permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; }
该
(voID)mapVIEw:(MKMapVIEw *)mapvIEw annotationVIEw:(MKAnnotationVIEw *)vIEw calloutAccessoryControlTapped:(UIControl *)control
触摸引脚时应该调用以显示标注权限吗?但是会发生一个空白的常规标注.我可能做错了什么?
顺便说一句:UIVIEwController子类只在它的XIB上有一个标签,几乎是空白的.
解决方法 午睡几分钟后找到答案.使用this作为指南,我只需要覆盖
-(voID)mapVIEw:(MKMapVIEw *)mapVIEw dIDSelectAnnotationVIEw:(MKAnnotationVIEw *)vIEw
它显示了注释标注.再次感谢安娜女士的回答.
总结以上是内存溢出为你收集整理的iOS Mapkit自定义标注全部内容,希望文章能够帮你解决iOS Mapkit自定义标注所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)