MWPhotoBrowser icon indicating copy to clipboard operation
MWPhotoBrowser copied to clipboard

Expose the Action Button as a MWPhotoBrowser Property.

Open AndyIbanez opened this issue 9 years ago • 2 comments

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.

AndyIbanez avatar Dec 05 '15 22:12 AndyIbanez

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:

WP

AndyIbanez avatar Dec 06 '15 01:12 AndyIbanez

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

MubeenQazi avatar Jan 26 '17 15:01 MubeenQazi