MWPhotoBrowser
MWPhotoBrowser copied to clipboard
Expose the Action Button as a MWPhotoBrowser Property.
I'm trying to present a UIAlertController of type .ActionSheet from within my current MWPhotoBrowser instance as a pop up view controller.
In the iPhone, this is no problem since the action sheet is presented modally, but on iPad, I need a place to show it from.
Ideally, I would like to do something like this:
actionSheet.popoverPresentationController?.barButtonItem = photoBrowser.actionButton
inside func photoBrowser(photoBrowser: MWPhotoBrowser!, actionButtonPressedForPhotoAtIndex index: UInt), instead of the alternatives like creating a rect or anything like that for my action sheet, to simply display the action sheet from there. I was looking at the MWPhotoBrowser class and it doesn't look like there's a way to grab this button from there at all.
EDIT:
Just tried photoBrowser.toolbarItems and it printed nil. Looks like there's absolutely no way to expose it.
I decided to provide my own cheap implementation as a temporary workaround:
-(UIBarButtonItem *)actionButton {
return _actionButton;
}
I wouldn't mind providing a more correct version of this to the repo if people want it.
I can now properly do this:
actionSheet.popoverPresentationController?.barButtonItem = photoBrowser.actionButton()
Which produces the desired result:

I want to do something similar to this. Can you tell me how to show action button only when image is enlarge ? and no action button while showing grid