ios - Apple Mapkit: Map doesn't start with my given coordinates -


i'm trying open map given set of co ordinates. isn't working. works if exit view , enter again.

here code -

mapviewcontroller.h

#import <uikit/uikit.h> #import <mapkit/mapkit.h>  @interface mapviewcontroller : uiviewcontroller <mkmapviewdelegate> @property (strong, nonatomic) iboutlet mkmapview *mapview;  @end 

mapviewcontroller.m

#import "mapviewcontroller.h"  @interface mapviewcontroller ()  @end  @implementation mapviewcontroller @synthesize mapview;  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }   - (void)viewdidload {     [super viewdidload];     self.mapview.delegate = self;      cllocationcoordinate2d zoomlocation;     zoomlocation.latitude = 39.281516;     zoomlocation.longitude= -76.580806;      mkcoordinateregion region = mkcoordinateregionmakewithdistance(zoomlocation, 800, 800);     [self.mapview setregion:[self.mapview regionthatfits:region] animated:yes]; }   @end 

sometimes have found methods animate screen not work expected when running @ same time view controller transitions. try moving code zoom map viewdidappear.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -