         }
     }
     
+    func image(at index: Int) -> UIImage? {
+        guard index >= 0 && index < images.count else {
+            return nil
+        }
+        return images[index]
+    }
     
     func tapPhotoView(sender: UITapGestureRecognizer) {
         if let tag = sender.view?.tag {

        
        for i in 0..<numShow {
            let image = dataSource.photoColletionView?(self, imageAt: i)
            if let image = image {
                images.append(image)
                if i == 0 {
                    isVertical = image.size.width < image.size.height
                }

    var margin: CGFloat = 1
    var maxImage = 4
    var photoViews: [PhotoView] = []
    var images: [UIImage?] = []
    
    weak open var dataSource: PhotoCollectionViewDataSource?
    weak open var delegate: PhotoCollectionViewDelegate?
