
对于我正在使用的注释视图
func mapVIEw(mapVIEw: MKMapVIEw!,vIEwForAnnotation annotation: MKAnnotation!) -> MKAnnotationVIEw! { let reuseID = "mapPin" var anVIEw = mapVIEw.dequeueReusableAnnotationVIEwWithIDentifIEr(reuseID) as? CustomCalloutVIEw if anVIEw == nil { anVIEw=CustomCalloutVIEw(annotation: annotation,reuseIDentifIEr:reuseID) anVIEw!.image = UIImage(named:"mappin.png") let button : UIbutton = UIbutton.buttonWithType(UIbuttonType.Detaildisclosure) as! UIbutton button.addTarget(self,action: "buttonClicked:",forControlEvents: UIControlEvents.touchUpInsIDe) anVIEw!.rightCalloutAccessoryVIEw=button //anVIEw!.addSubvIEw(vIEwC) mapVIEwControl.addAnnotation(annotation) } else { anVIEw!.annotation = annotation } return anVIEw} 并d出标注视图
func mapVIEw(mapVIEw: MKMapVIEw!,dIDSelectAnnotationVIEw vIEw: MKAnnotationVIEw!){ var vIEwC:UIVIEw=UIVIEw(frame: CGRectMake(0,50,50)) vIEwC.backgroundcolor = UIcolor.blackcolor() vIEw.addSubvIEw(vIEwC) vIEwC.center = CGPointMake(vIEwC.bounds.size.wIDth*0.1,-vIEwC.bounds.size.height*0.5)}解决方法 我得到了解决方案它的变化非常小.在vIEwForAnnotation中隐藏基本标注如下, anVIEw!.canShowCallout = false总结
以上是内存溢出为你收集整理的MKMapView的Swift自定义标注全部内容,希望文章能够帮你解决MKMapView的Swift自定义标注所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)