DMActivityInstagram icon indicating copy to clipboard operation
DMActivityInstagram copied to clipboard

Skipping Resize Controller

Open rollinsw opened this issue 11 years ago • 5 comments

Thanks for this great library. Is there any way to skip the steps for resizing/rotating the image? My project already does all the checking for making sure the image is square and large enough.

Thanks again, Bill

rollinsw avatar Nov 02 '13 13:11 rollinsw

Hey Bill,

Right now, if you pass a square image to the DMActivityInstagram, the current behaviour should be to show the resize/crop view for a moment and then go right to the UIDocumentInteractionController. If you'd like skip the resize/crop view entirely, your best bet is probably to subclass DMActivityInstagram so you can return nil from it's -activityViewController method, which will prevent the resize controller from being shown. That should be enough get what you want, but I've not built it to perform that way so you may want to do some QC on that and make sure it doesn't muck anything else up.

A pull request with this behaviour as an optional feature would be welcomed :)

coryalder avatar Nov 03 '13 10:11 coryalder

Thanks for the response! I've tried returning nil from activityViewControllerand the default behavior correctly calls the performActivity method. The UIDocumentInteractionController doesn't open, however, because I think it is expecting to be opened via a button on the ResizerViewController.

I'm not sure exactly how to get the document controller to open, I'll take a look at that further.

Thanks, Bill

rollinsw avatar Nov 03 '13 13:11 rollinsw

DMActivityInstagram has a property (presentFromButton) that accepts a UIBarButtonItem to present the document interaction controller from. Try setting that, if you have a bar button you can use. Otherwise you'll have to modify - (void)performActivity, specifically the last line where it presents the document interaction controller.

On Nov 3, 2013, at 5:56 AM, Bill Rollins [email protected] wrote:

Thanks for the response! I've tried returning nil from activityViewControllerand the default behavior correctly calls the performActivity method. The UIDocumentInteractionController doesn't open, however, because I think it is expecting to be opened via a button on the ResizerViewController.

I'm not sure exactly how to get the document controller to open, I'll take a look at that further.

Thanks, Bill

— Reply to this email directly or view it on GitHub.

coryalder avatar Nov 05 '13 08:11 coryalder

If you don't have a UIBarButtonItem that you can use, you can actually just present the UIDocumentInteractionController using - (BOOL)presentOpenInMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated. Pass in CGRectZero and the view of your UIActivityViewController. Works great.

DimaVartanian avatar Mar 19 '14 01:03 DimaVartanian

Hi @DimaVartanian @coryalder @rollinsw , could you give a little example code on how to accomplish this? I really can not get this to work without showing the resize controller. Thanks!

ortizroberto avatar Apr 17 '15 00:04 ortizroberto