     public weak var image: UIImage? {
         didSet {
             // 释放以节省资源
-            livePhotoView.removeFromSuperview()
+            livePhotoView?.removeFromSuperview()
             livePhotoView = nil
             destroyVideoRelatedObjectsIfNeeded()
             

            imageView.frame = image.size.rect.applying(imageView.transform)

            hideViews()
            self.imageView.hidden = false
            
            revertZooming()
        }

        let gesturePoint =  gestureRecognizer.location(in: gestureRecognizer.view)
        delegate?.doubleTouch(in: self, location: gesturePoint)
        
        guard enabledZoomImageView else {
            return
        }

        // 如果图片被压缩了，则第一次放大到原图大小，第二次放大到最大倍数
        if scrollView.zoomScale >= scrollView.maximumZoomScale {
            setZoomScale(scrollView.minimumZoomScale, animated: true)
        } else {
            var newZoomScale: CGFloat = 0
            if scrollView.zoomScale < 1 {
                // 如果目前显示的大小比原图小，则放大到原图
                newZoomScale = 1
            } else {
                // 如果当前显示原图，则放大到最大的大小
                newZoomScale = scrollView.maximumZoomScale
            }
            
            var zoomRect = CGRect.zero
            let tapPoint = currentContentView?.convert(gesturePoint, to: gestureRecognizer.view) ?? .zero
            zoomRect.size.width = bounds.width / newZoomScale
            zoomRect.size.height = bounds.height / newZoomScale
            zoomRect.origin.x = tapPoint.x - zoomRect.width / 2
            zoomRect.origin.y = tapPoint.y - zoomRect.height / 2
            zoom(to: zoomRect, animated: true)
        }
    }
    
