[英]How to add hyperlink in subtitle on callout view using objective-c
In my iPhone app, I require to show the hyperlink to a website in subtitle on callout view. 在我的iPhone应用程序中,我需要在标注视图上的字幕中显示指向网站的超链接。 I am using displaymap class url is Can someone point me to a leak in this code?
我正在使用displaymap类网址, 有人可以指出此代码中的漏洞吗?
I need add hyperlink in subtitle.help me 我需要在subtitle.help中添加超链接
By Siva M 西瓦·M(Siva M)
I think you can fulfill your requirement in this way.. 我认为您可以通过这种方式满足您的要求。
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
MKPinAnnotationView *locationView;
locationView=[[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"] autorelease];
locationView.pinColor=MKPinAnnotationColorPurple;
locationView.animatesDrop=TRUE;
locationView.canShowCallout =YES;
locationView.annotation=annotation;
locationView.calloutOffset = CGPointMake(-5, 5);
UITextView *text=[[UITextView alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
text.dataDetectorTypes=UIDataDetectorTypeLink ;
text.backgroundColor=[UIColor clearColor];
text.editable=NO;
text.text=@"http://google.com";
locationView.rightCalloutAccessoryView = text;
return locationView;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.