BentoMap icon indicating copy to clipboard operation
BentoMap copied to clipboard

The example hangs

Open zhouhao27 opened this issue 6 years ago • 1 comments

When I ran the app for MapKit Example, it hangs when I zoom in/zoom out or pan the screen.

zhouhao27 avatar Jul 25 '19 09:07 zhouhao27

I think it's caused by this:

   let snapshots: [UIView] = toRemove.flatMap { annotation in
            guard let annotationView = mapView.view(for: annotation),
                let snapshot = annotationView.snapshotView(afterScreenUpdates: false),
                mapView.frame.intersects(annotationView.frame) == true else {
                return nil
            }
            snapshot.frame = annotationView.frame
            mapView.insertSubview(snapshot, aboveSubview: annotationView)
            return snapshot
        }

        UIView.animate(withDuration: 0.2, animations: {
            for snapshot in snapshots {
                snapshot.transform = CGAffineTransform(scaleX: 0.01, y: 0.01)
                snapshot.layer.opacity = 0
            }
        },
                       completion: { _ in
                        for snapshot in snapshots {
                            snapshot.removeFromSuperview()
                        }
        })

After I removed these lines, everything is ok.

zhouhao27 avatar Jul 25 '19 09:07 zhouhao27