且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在GMSMapView上拖动时,iOS布局动画会忽略持续时间

更新时间:2023-01-06 07:42:53

我在Google( https://code.google.com/p/gmaps-api-issues/issues/detail? id = 10349 ),这是他们的回应:

I opened a bug on this issue with Google (https://code.google.com/p/gmaps-api-issues/issues/detail?id=10349), and this was their response:


我们的理解是,发生这种情况是因为mapView:willMove:已在CoreAnimation事务中进行调用。我们建议的解决方法是将UIView.animateWithDuration调用包装在dispatch_async中,回到主线程。类似于以下内容:

Our understanding is that this is happening because the mapView:willMove: call is being made while already inside a CoreAnimation transaction. Our suggested work around is to wrap the UIView.animateWithDuration call within a dispatch_async back to the main thread. Something along the lines of:

dispatch_async(dispatch_get_main_queue(),^ {
//此处的动画块。
});

dispatch_async(dispatch_get_main_queue(), ^{ // animation block here. });

有帮助吗?

将UIView.animateWithDuration块放置在dispatch_async块中对于我。

Placing the UIView.animateWithDuration block inside a dispatch_async block worked for me.