Mapbox-gl-native: Issue MGLAnnotationView subclass and AutoLayout

Created on 7 Aug 2017  路  4Comments  路  Source: mapbox/mapbox-gl-native

Platform: iOS 10.3.x
Mapbox SDK version: 3.6.1

Steps to trigger behavior

  1. Subclass MGLAnnotationView adding an UIImageView.
  2. Constrain the image view to the edges.
  3. Use an image for the normal state and an image for the selected state.
  4. Set the selected state of the annotation view.

Expected behavior

The selected view should grow in size and remain in position.

Actual behavior

The annotation view moves to the top left corner.

Note, I tried this without AutoLayout and if you set the frame yourself the pin will also move to top left unless the frame origin is preserved. So it looks like the AutoLayout issue might stem from this?

I modified your sample code: https://gist.github.com/aodhol/c4490cf2063628bf8fb96c637caa43e9 (you will just need to images - a small pin image and a large pin image).

simulator screen shot 7 aug 2017 20 04 14

simulator screen shot 7 aug 2017 19 49 43

annotations archived iOS

Most helpful comment

Just a quick guess that this code might be responsible, since it modifies the view鈥檚 frame manually rather than using Auto Layout:

https://github.com/mapbox/mapbox-gl-native/blob/268a4d7404d30dc4f866711e3fd1e778892bbe35/platform/ios/src/MGLMapView.mm#L5702-L5722

All 4 comments

I have same issue connected with AutoLayout. Do you know solution ? Temporary solution for the @aodhol is to use greaterThanOrEqualTo instead of equalTo.

Just a quick guess that this code might be responsible, since it modifies the view鈥檚 frame manually rather than using Auto Layout:

https://github.com/mapbox/mapbox-gl-native/blob/268a4d7404d30dc4f866711e3fd1e778892bbe35/platform/ios/src/MGLMapView.mm#L5702-L5722

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

klblk picture klblk  路  4Comments

tobrun picture tobrun  路  3Comments

lamhuynh96 picture lamhuynh96  路  3Comments

fousa picture fousa  路  3Comments

melihcolpan picture melihcolpan  路  3Comments