[TIMOB-2673] iPhone Map: Adding regionChanged listener causes map region to change
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2012-07-26T14:26:22.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Jonathan Harlap |
Assignee | Neeraj Gupta |
Created | 2011-04-15T03:26:35.000+0000 |
Updated | 2012-07-26T21:13:50.000+0000 |
Description
When creating a map view, if you add a regionChanged listener then it changes the displayed region, as illustrated by http://developer.appcelerator.com/question/77481/map-region-doesnt-fit-in-mapview-of-titanium-when-catch-event-regionchanged"> http://developer.appcelerator.com/question/77481/map-region-doesnt-...
This is because when firing the event the code alters the region
object when it should simply read it.
TiMapView.m in the github master as of today reads (around line
516):
if ([self.proxy _hasListeners:@"regionChanged"])
{
region = [mapView region];
It should not be modifying the region instance variable, so
simply changing this line to read MKCoordinateRegion region =
[mapView region];
solves the problem.
Can't reproduce in SDK 2.2.0.014b86f on iPhone Sim 5.1. Test code: