热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

设置MKPolylineViewlineDashPattern为动画-iPhone-setMKPolylineViewlineDashPatterntobeanimated

IhavebeentryingtoworkonaapplicationusingtheMapKitandMKPolyline.Ihavegottentheannot

I have been trying to work on a application using the MapKit and MKPolyline. I have gotten the annotations and paths drawn on the map, however I am trying to change the lineDashPattern to be a set of animated dashes in the direction of the course. I know that the lineDashPhase and lineDashPattern together give you a dashed line, and the more you increase lineDashPhase, the more the dashes move, however is there a way to increase the values in such a way that it appears that it is moving, sort of like ants along a line I guess is a good analogy.

我一直在尝试使用MapKit和MKPolyline开发一个应用程序。我已经得到了在地图上绘制的注释和路径,但是我正在尝试将lineDashPattern更改为课程方向上的一组动画破折号。我知道lineDashPhase lineDashPattern一起给你一个虚线,并增加lineDashPhase越多,越破折号,然而有办法提高值,这样看来,它是移动,有点像蚂蚁沿着一条线我想是一个很好的类比。

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id)overlay
{
    MKOverlayView* overlayView = nil;

    if(overlay == self.routeLine)
    {
        //if we have not yet created an overlay view for this overlay, create it now.
        if(self.routeLineView == nil)
        {
            self.routeLineView = [[[MKPolylineView alloc] initWithPolyline:self.routeLine] autorelease];
            self.routeLineView.lineWidth = 5;
            self.routeLineView.lineDashPhase = 15;
            NSArray* array = [NSArray arrayWithObjects:[NSNumber numberWithInt:20], [NSNumber numberWithInt:20], nil];  
            self.routeLineView.lineDashPattern = array;
        }

        overlayView = self.routeLineView;

    }

    return overlayView;

}

This right now give me dashed lines. I know there is a similar topic here, however I am not sure how to go about this. Any input would be greatly appreciated!

这个现在给我虚线。我知道这里也有一个类似的话题,但是我不知道该怎么说。如有任何意见,我们将不胜感激!

1 个解决方案

#1


2  

I know this is a pretty old question, but I have just implemented a similar solution and posted it here.

我知道这是一个很老的问题,但我刚刚实现了一个类似的解决方案,并在这里发布了它。


推荐阅读
author-avatar
pop6959140
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有