Closed cansurmeli closed 7 years ago
Hi @cansurmeli
it's not happening at the moment, but I remember the custom annotation views appearing with black boxes around even though I haven't defined them
This does not sound like a Mapbox SDK issue. If you still see this please post a sample project or clear steps to reproduce so we can investigate. I did notice that in the code you pasted in this issue, you are setting annotationView = VoiAnnotationView
and then immediately to annotationView = MGLAnnotationView
so, in that example, you would not actually see VoiAnnotationView
s. Perhaps you inadvertently enabled some view debugging feature in Xcode?
My custom annotation views, VoiAnnotationView, seems to be appearing after a noticeable delay
Can you define how long the delay is? Where are you testing (device or simulator) and what are other details of your development env (i.e. what kind of device and model, iOS version, Xcode version, etc.)? "Noticeable delay" is not enough information for us to make this issue actionable for that part of your report.
[annotations'] respective locations on the screen does not get reflected as they should
Can you please better define "as they should"? If possible please provide a .mov. gif (or similar) that illustrates the problem along with a project or sample code that reproduces the issue.
Thank you
Thanks for the reply @boundsj.
I updated my original answer thinking it would be better for future references.
Sorry for the silly mistake of immediately reassigning my custom annotation view, VoiAnnotationView
, with MGLAnnotationView
. That was a debug thing I was doing myself.
Hope the edit sheds some more light.
Thanks for the additional information @cansurmeli
I can see from the gif you supplied that you are definitely having issues using annotation views. Based on the error you are getting from iOS This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread
it seems like you might be using multiple threads (i.e. downloading information from the network on a background thread that results in annotation views getting added on that background thread). You may want to audit your view controllers and make sure you are doing UI work on the main thread.
In any case, I'm still unable to reproduce the issues you are describing with the information you provided. Can you please attach an isolated sample app that reproduces this issue?
Also, there is an open PR (https://github.com/mapbox/mapbox-gl-native/pull/8926) to fix issues related to annotation views becoming detached when going offscreen (either because of a zero size annotation view or an annotation view that gets animated from a very small size to something larger). Of course you are welcome to try the fix in that PR but it looks like the issue you are experiencing won't be helped by that alone.
p.s. the Mapbox tutorial I mentioned above makes use of layoutSubviews method which as the Apple documentation states, should not be called directly but instead the method setNeedsLayout be called. What's the deal with that?
It is true that the Apple documentation states you should not call layoutSubviews
directly. However, the Mapbox example you referenced does not call layoutSubviews. It overrides that method which is valid.
Once I took my network call's completion handler to the main queue, everything got handled.
It never occurred to me this way. Silly mistake, actually. Thanks @boundsj. 👍🏻
Hello.
I'm trying to implement a custom annotation view where an annotation will have borders around them and get bigger when selected(by making use of an UIImageView and swapping the images). Plus various animations when they first drop or when they get selected.
Therefore I'm making use of the
-mapView:imageForAnnotation:
method along with building on top ofMGLAnnotationView
class.I've followed the following Mapbox tutorial and here is where I'm at currently:
My custom annotation views, VoiAnnotationView, seems to be appearing after a noticeable delay and when the map view gets moved around/zoomed, their respective locations on the screen does not get reflected as they should. Plus, the custom annotation views appearing with black boxes around even though I haven't defined them.
Also, I'm getting the following error message for each of the annotations I drop.
For a better understanding, here is a GIF:
Am I missing something here or is there a bug in the SDK? I've seen a similar issue here which I posted under it as well.
p.s. I recently updated to Mapbox-iOS-SDK 3.5.3; didn't help. I'm using the latest version of iOS along with Xcode. The above GIF is from the simulator but the situation applies to on device as well.
p.s. the Mapbox tutorial I mentioned above makes use of
layoutSubviews
method which as the Apple documentation states, should not be called directly but instead the methodsetNeedsLayout
be called. What's the deal with that?Platform: iOS Mapbox SDK version: 3.5.3