MKMapView regionDidChangeAnimated not always called!

后端 未结 5 1790
北荒
北荒 2021-01-17 14:31

This is frustrating me!!!

It will be called most of the time but then it stops responding to the pinches. It will be called on a screen rotate and a double tap. No

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-17 15:12

    I think this problem may have something to do with multi-threading.

    I had the same problem this morning. I use a gesture recognizer to capture long press event and then add a pin to the mapview. If works well but after a few rounds, the region did change method stop being called.

    I tried a few solutions here but none works. Then I recalled some other issue I had before with multi-threading nature of actions. So I try to moved the code that controls the mapview in long press action to a block that runs in main thread. And the problem is solved.

提交回复
热议问题