iphone - How to add a callout having one title -
my map code:
if (latitude != [nsnull null] && longitude != [nsnull null]) { location.latitude=[latitude doublevalue]; location.longitude=[longitude doublevalue]; myannotationview *newannotation=[[myannotationview alloc]initwithtitle:[nsstring stringwithformat:@"bus-%d",h] latitude:location.latitude longitude:location.longitude]; [self.mymap addannotation:newannotation]; mymap.maptype=mkmaptypestandard; [mymap setcentercoordinate:location animated:yes]; mkcoordinateregion region = mkcoordinateregionmakewithdistance(location,1000,1000); [mymap setregion:region animated:yes]; } -(void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { location.latitude=newlocation.coordinate.latitude; location.longitude=newlocation.coordinate.longitude; myannotationview *newannotation=[[myannotationview alloc]initwithtitle:[nsstring stringwithformat:@"bus-%d",h] latitude:location.latitude longitude:location.longitude]; [self.mymap addannotation:newannotation]; mkcoordinateregion region = mkcoordinateregionmakewithdistance(location,1000, 1000); [mymap setregion:region animated:yes]; [mymap setcentercoordinate:newlocation.coordinate animated:yes]; }
mkannotationview.h
@implementation myannotationview @synthesize title,coordinate; -(id)initwithtitle:(nsstring *)newtitle latitude:(float)newlatitude longitude:(float)newlongitude { if (self=[super init]) { title=newtitle; coordinate.latitude=newlatitude; coordinate.longitude=newlongitude; } return self; }
how can add callout title? it's not popping out when click on annotation. when click, following thread error
exc_breakpoint(code=exc_1386+bpt,subcode 0.0)
Comments
Post a Comment