Closed kitanai-kitsune closed 4 years ago
import UIKit import ImageViewer
class ViewController: UIViewController, GalleryItemsDataSource {
var galleryItem: GalleryItem! override func viewDidLoad() { super.viewDidLoad() let image = UIImage(named: "sample") galleryItem = GalleryItem.image{ $0(image) } let imageView = UIImageView(frame: CGRect(x: 100, y: 100, width: view.frame.width - 100*2, height: 200)) imageView.image = image imageView.contentMode = UIImageView.ContentMode.scaleAspectFill view.addSubview(imageView) imageView.isUserInteractionEnabled = true let recognizer = UITapGestureRecognizer(target: self, action: #selector(self.onTap(_:))) imageView.addGestureRecognizer(recognizer) } @objc func onTap(_ sender: UIImageView) { let galleryViewController = GalleryViewController(startIndex: 0, itemsDataSource: self, configuration: [.deleteButtonMode(.none), .seeAllCloseButtonMode(.none), .thumbnailsButtonMode(.none)]) self.present(galleryViewController, animated: true, completion: nil) } // MARK: GalleryItemsDataSource func itemCount() -> Int { return 1 } func provideGalleryItem(_ index: Int) -> GalleryItem { return galleryItem }
}
I have the same problem. Could you tell me, how you deal with it?
import UIKit import ImageViewer
class ViewController: UIViewController, GalleryItemsDataSource {
}