Saturday, 15 August 2015

ios - didUpdateUserLocation not calling with view reloaded -



ios - didUpdateUserLocation not calling with view reloaded -

i'm getting error in ios application. i've searched in google , here, specific solution not found!

i have viewcontroller called mapview utilize in 2 moments in app, view contains mkmapview , code.

in mapview.h there is:

@property (strong, nonatomic) iboutlet mkmapview *mapspot;

and in mapview.m there is:

- (void)viewdidload { [super viewdidload]; [mapspot setshowsuserlocation:yes]; } - (void) mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation{ mkcoordinateregion part = mkcoordinateregionmakewithdistance([userlocation coordinate], 500, 500); [mapspot setregion:region animated:yes]; }

so, in first moment load mapview other viewcontroller using:

@property (strong, nonatomic) viewmap *mapview; mapview = [[viewmap alloc] initwithnibname:@"viewmap" bundle:nil]; [self.view addsubview:[mapview view]];

i unload viewcontroller , in viewcontroller in other moment load mapview again, in moment method: - (void) mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation not called.

i verify if first viewcontroller unloaded , was.

when load sec viewcontroller there new instace of mapview, not phone call delegate method.

anyone know that?

thanks

==================================================================================

edit , solved:

the problem in way adding view, in line

[self.view addsubview:[mapview view]];

if add together view controller code not executed, instead of has nowadays mapview, example:

[self presentviewcontroller:mapview animated:yes completion:nil];

ios delegates mapkit mkmapviewdelegate

No comments:

Post a Comment