Closed chrisvoronin closed 5 years ago
Hey @chrisvoronin, this should be possible by setting:
PhotosViewController.overlayView.rightBarButtonItem = nil
@alexhillc is there any way to replace the icon?
photosViewController.overlayView.leftBarButtonItem?.image = UIImage(named: "close-icon")
does not work (version 1.2.10)
And I need to remove Share as well, but this code does not work š@alexhillc
Hey @bizibizi, in earlier versions of AXPhotoViewer (1.2.10) the overlay was instantiated with the rest of the views, which made it inconvenient to customize it before presenting the view controller. To get around this, simply load the view before customizing the pager:
photosViewController.loadViewIfNeeded()
photosViewController.overlayView.rightBarButtonItem = nil
As for the close button, you will have to subclass the PhotosViewController
and override closeBarButtonItem
, returning a UIBarButtonItem
with a custom image. You can leave the target and action of the UIBarButtonItem
nil (the pager will set these manually). That should get the behavior that you are expecting.
However, I do recommend updating your project to Swift 4! With the Swift 4 update came many key iOS 11 features, including safe area insets.
Yes, this works, thank you! And how can I add share button to the bottom (with custom image preferable). I am looking on the code sample but looks like 1.2.10 does not have ābottomStackContainerā to do that:
photosViewController.overlayView.bottomStackContainer.insertSubview(bottomView, at: 0)
And how can I attach ātarget and actionā to that share button?
On May 10, 2018, at 18:43, Alex Hill notifications@github.com wrote:
Hey @bizibizi https://github.com/bizibizi, in earlier versions of AXPhotoViewer (1.2.10) the overlay was instantiated with the rest of the views, which made it inconvenient to customize it before presenting the view controller. To get around this, simply load the view before customizing the pager:
photosViewController.loadViewIfNeeded() photosViewController.overlayView.rightBarButtonItem = nil As for the close button, you will have to subclass the PhotosViewController and override closeBarButtonItem, returning a UIBarButtonItem with a custom image. You can leave the target and action of the UIBarButtonItem nil (the pager will set these manually). That should get the behavior that you are expecting.
However, I do recommend updating your project to Swift 4! With the Swift 4 update came many key iOS 11 features, including safe area insets.
ā You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alexhillc/AXPhotoViewer/issues/32#issuecomment-388111488, or mute the thread https://github.com/notifications/unsubscribe-auth/AF2Tip1MkWjJsnZ-65_lW4biXR5o-JNpks5txG4wgaJpZM4T5K58.
@bizibizi, unfortunately in older versions of the library there is not a viable way to do what you want. As you said, in 1.2.10, there is no "bottomStackContainer", so adding custom views to the bottom of the photo viewer becomes a pain.
I guess what you could do is create an AXCaptionView
subclass (caption view lives at the bottom of the photo viewer, so that should get you what you want) and include a share button in that view. You can set a custom caption view using the following:
photosViewController.loadViewIfNeeded()
photosViewController.overlayView.captionView = SomeCustomCaptionView()
Hi Alex,
Just let me say this first... very awesome library, saved me a ton of time. Thank you for making this and sharing this. Using Kingfisher loader too.
One quick question I have, is there an easy way to hide the share icon? I didn't see some option when I looked around.
Thank you,
Chris