大佬教程收集整理的这篇文章主要介绍了ios – 在为其框架设置动画时禁用向mapView添加注释,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在使用上面的@L_874_0@扩展mapView时,我看到mapView正在添加错误的注释,直到动画结束.动画完成后,放错位置的注释会消失.
展开地图时,调用如下:
> animateWithDuration开始
> mapView:regionWillChangeAnimated
> mapView:didAddAnnotationViews
> mapView:regionDidChangeAnimated
> animateWithDuration完成
我最小化地图时没问题可能是因为没有@L_86_3@mapView:didAddAnnotationViews.
我可以在动画时以某种方式禁用mapviews regionWillChange吗?
动画前:
动画中途.看到很多错失的注释.
动画完成了.所有错失的注释都消失了.
像这样的东西:
@H_772_2@- (UIImage *)imageFromView:(UIView *) view { if ([[UIScreen mainScreen] respondsToSELEctor:@SELEctor(scalE)]) { UIGraphicsBeginImageContextWithOptions(view.frame.size,NO,[[UIScreen mainScreen] scale]); } else { UIGraphicsBeginImageContext(view.frame.sizE); } [view.layer renderInContext: UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } - (void)foo { UIImageView *mapScreenShotView = [[UIImageView alloc] initWithImage:[self imageFromView:self.mapView]]; mapScreenShotView.frame = self.mapView.frame; [self.mapView.superview addSubview:mapScreenShotView]; self.mapView.hidden = YES; CGRect frame = self.mapView.frame; frame.origin = ... frame.size = ... // here no more need to animate mapView,because currently its hidden. So we will change it's frame in outside of animation block. self.mapView.frame = frame; [UIView animateWithDuration:0.25f animations:^{ mapScreenShotView.frame = frame; } completion:^{ self.mapView.hidden = NO; [mapScreenShotView removeFromSuperview]; }]; }以上是大佬教程为你收集整理的ios – 在为其框架设置动画时禁用向mapView添加注释全部内容,希望文章能够帮你解决ios – 在为其框架设置动画时禁用向mapView添加注释所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。