[英]How to add hyperlink in subtitle on callout view using objective-c
在我的iPhone應用程序中,我需要在標注視圖上的字幕中顯示指向網站的超鏈接。 我正在使用displaymap類網址, 有人可以指出此代碼中的漏洞嗎?
我需要在subtitle.help中添加超鏈接
西瓦·M(Siva M)
我認為您可以通過這種方式滿足您的要求。
- (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.