小编Alp*_*sai的帖子

更新注释视图时如何在自定义注释引脚中执行动画

我想做动画,例如"在滚动collection view cell结束时滚动注释引脚向上/向下滚动.但是当滚动结束时,如何开始滚动时注释引脚等动画上升,注释引脚变为向下collection view

//code --> For Scrolling
func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
    if scrollView == collectionView {
        NSLog("page collection %d",Int(scrollView.contentOffset.x/scrollView.frame.size.width))
        self.UpdateMapAnotationPin(Int(scrollView.contentOffset.x/scrollView.frame.size.width))
    }
}

//  -->When Update Pin

func UpdateMapAnotationPin(vIndex : Int) {
    if self.mapAnnotations.count != 0 {
        let info = self.mapAnnotations[vIndex]
        let aView = map.viewForAnnotation(info)
        info.imageName = "ic_map_pin1"
        info.tagPin = vIndex
        aView?.image = UIImage(named: info.imageName)

        if aView != nil {
            self.animationWithView(aView!)
        }
    }
}
//   --> For animation

func animationWithView(mkView : MKAnnotationView) {
    let point:MKMapPoint  =  MKMapPointForCoordinate(mkView.annotation!.coordinate); …
Run Code Online (Sandbox Code Playgroud)

mapkit mkmapview mkannotationview ios swift

9
推荐指数
1
解决办法
716
查看次数

标签 统计

ios ×1

mapkit ×1

mkannotationview ×1

mkmapview ×1

swift ×1