Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional property for defining a custom fullscreen close button. #394

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thisisaaronland
Copy link

This PR tries to build on #385 but rather than defining new presets allows for a consume of the ImageSlideshow package to define a custom UIButton to use for ending fullscreen mode.

The button is assigned to the slideshow's fullscreenCloseButton property which is then assigned to the FullScreenSlideshowViewController's closeButtonCustom property. For example:

        let closeButton = UIButton()
        closeButton.setImage(UIImage(systemName: "xmark"), for: UIControl.State())
        closeButton.tintColor = .white
        
        slideshow.fullscreenCloseButton = closeButton

@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by if let avoiding the force unwrapping

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the slow reply. Just to confirm, this should be:

if let custom_button = closeButtonCustom {
      closeButton = custom_button
}

Or something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants