diff --git a/ImageSlideshow/Classes/Core/FullScreenSlideshowViewController.swift b/ImageSlideshow/Classes/Core/FullScreenSlideshowViewController.swift index a010d421..ab99fe1d 100644 --- a/ImageSlideshow/Classes/Core/FullScreenSlideshowViewController.swift +++ b/ImageSlideshow/Classes/Core/FullScreenSlideshowViewController.swift @@ -25,6 +25,9 @@ open class FullScreenSlideshowViewController: UIViewController { /// Close button open var closeButton = UIButton() + /// Custom close button + open var closeButtonCustom: UIButton? + /// Close button frame open var closeButtonFrame: CGRect? @@ -71,8 +74,13 @@ open class FullScreenSlideshowViewController: UIViewController { view.addSubview(slideshow) - // close button configuration - closeButton.setImage(UIImage(named: "ic_cross_white", in: Bundle(for: type(of: self)), compatibleWith: nil), for: UIControlState()) + if closeButtonCustom != nil { + closeButton = closeButtonCustom! + } else { + // close button configuration + closeButton.setImage(UIImage(named: "ic_cross_white", in: Bundle(for: type(of: self)), compatibleWith: nil), for: UIControlState()) + } + closeButton.addTarget(self, action: #selector(FullScreenSlideshowViewController.close), for: UIControlEvents.touchUpInside) view.addSubview(closeButton) } diff --git a/ImageSlideshow/Classes/Core/ImageSlideshow.swift b/ImageSlideshow/Classes/Core/ImageSlideshow.swift index 9d4fbd37..12bb8c84 100644 --- a/ImageSlideshow/Classes/Core/ImageSlideshow.swift +++ b/ImageSlideshow/Classes/Core/ImageSlideshow.swift @@ -136,6 +136,9 @@ open class ImageSlideshow: UIView { /// Called on scrollViewDidEndDecelerating open var didEndDecelerating: (() -> Void)? + /// Custom fullscreen close button + open var fullscreenCloseButton: UIButton? + /// Currenlty displayed slideshow item open var currentSlideshowItem: ImageSlideshowItem? { if slideshowItems.count > scrollViewPage { @@ -543,6 +546,7 @@ open class ImageSlideshow: UIView { self?.setCurrentPage(page, animated: false) } + fullscreen.closeButtonCustom = fullscreenCloseButton fullscreen.initialPage = currentPage fullscreen.inputs = images slideshowTransitioningDelegate = ZoomAnimatedTransitioningDelegate(slideshowView: self, slideshowController: fullscreen)