Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1046] calling selectAnnotation on mapview outside of event listener does not work

GitHub Issuen/a
Resolution Date2011-04-17T01:55:03.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.4.0
ReporterNolan Wright
AssigneeBlain Hamon


in Kitchen Sink - Base UI -> Views -> Map View


  1. Stephen Tramer 2011-04-15

    This should have been fixed by #918 but there are a couple changes I can make to the code to make it more robust (I think). Using this ticket as an excuse to go back in and clean up the original hack if possible.

  2. Stephen Tramer 2011-04-15

    From the MKMapView documentation:

    If the specified annotation is not onscreen, and therefore does not have an associated annotation view, this method has no effect.

    Annotations do not become onscreen at least until the map view has been drawn, which only happens at the end of the JS. Updated the documentation to reflect this.

  3. Nolan Wright 2011-04-15

    we have to figure this out. it's perfectly reasonable to want your annotation to be visible when the map is rendered

  4. Stephen Tramer 2011-04-15

    I agree that it's perfectly reasonable, but we can't do anything about the limitations of MKMapView. I would say that we could queue selections, to be selected once the map is displayed, but this does not get around the restriction that annotations must be visible on the current map display to be selected.

  5. Stephen Tramer 2011-04-15

    Okay, think I have a solution. Was a good idea to reopen this.

  6. Stephen Tramer 2011-04-15

    Alright, we can support the following:

    • add/remove annotation work correctly before map is displayed
    • annotations (which are in the visible region) will select on load

    HOWEVER, the following features will still need to be added:

    • zooming so that all annotations they want selected are visible (BEFORE selecting them)
    • recentering the view on the appropriate region BEFORE selecting an annotation contained within it

    These are much easier to do on the JS end than the Cocoa Touch end, so we may be able to stall on them for a while.

  7. Jeff Haynie 2011-04-15

    (from [23d0511b83365e6b3912ebbd517ca43a7dc9474f]) [#1046 state:open] First set of fixes for map view add/select including small modifications to KS to test. Second set will involve moving the visible region to a newly selected annotation. http://github.com/appcelerator/titanium_mobile/commit/23d0511b83365e6b3912ebbd517ca43a7dc9474f"> http://github.com/appcelerator/titanium_mobile/commit/23d0511b83365...

  8. Stephen Tramer 2011-04-15

    Hey, looks like the map view documentation is wrong. We can, in fact, select an annotation in the annotations list and the map automatically jumps to the right point.

    However, selecting annotations that were added with addAnnotation(s) may not work. Need to take a look at the current annotation management framework as a result.

  9. Jeff Haynie 2011-04-15

    (from [3c14b2eec6b641ab53cbd43fa0aabab1161955ba]) Closes #1046: Annotation addition/removal now happens immediately, not on a delay. No idea why there was a delay in the first place; users can always use careful annotation management to batch display. http://github.com/appcelerator/titanium_mobile/commit/3c14b2eec6b641ab53cbd43fa0aabab1161955ba"> http://github.com/appcelerator/titanium_mobile/commit/3c14b2eec6b64...

JSON Source