ios6 - using saved GPS coordinates from CLLocation to plot on the iPhone map -
i have been using core data save user's location various times in table view. can location details (coordinates mainly) @ various times, plot coordinates available @ each time on mapview (no overlays, single point point location @ time). have coordinates (one latitude , 1 longitude value) available, know how plot them on mapview.
just put question simply, how 1 can plot coordinates on mapview ?
i browsed through , not able find exact solution solve problem ! appreciated.
thanks time !
regards,
raj.
with of mkannotation, problem can solved. @craig , vishal kurup !
create annotation class subclass of nsobject.
in annotation.h:
@interface annotation : nsobject <mkannotation> @property (nonatomic, assign) cllocationcoordinate2d coordinate; @property (nonatomic, assign) nsstring *title; @property (nonatomic, assign) nsstring *subtitle; @end
it should conform mkannotation , 3 properties ones required when conforming mkannotation class. declare , synthesize them in .m file.
in maphistoryviewcontroller implementation file, need add few lines of codes view annotation @ required coordinates.
maphistoryviewcontroller.m:
@interface maphistoryviewcontroller (){ cllocationcoordinate2d annotationcoord; annotation *annotation; } @end @implementation maphistoryviewcontroller - (void)viewdidload { [super viewdidload]; // define coordinate annotation annotationcoord.latitude = maphistorylocation.coordinate.latitude; annotationcoord.longitude = maphistorylocation.coordinate.longitude; annotation = [annotation alloc]; annotation.coordinate = annotationcoord; annotation.title = streetannotation; // display annotation [self.maphistoryview addannotation:annotation]; // maphistoryview mkmapview object } //you can set region too, if want map focused on coordinates have provided //hope people same question :)
Comments
Post a Comment