andreagiavatto / AGPhotoBrowser

A photo browser for iOS inspired by Facebook.
Apache License 2.0
447 stars 85 forks source link

Problem using with UIActionSheet #17

Closed rocxteady closed 10 years ago

rocxteady commented 10 years ago

I create UIActionSheet before display AGPhotoBrowser. In delegate of UIActionSheet When I click display AGPhotoBrowser display the image but suddenly close its view. How can I resolve this?

I only change these lines of codes of depo project.

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 0) { [self.browserView showFromIndex:0]; }

}

}

andreagiavatto commented 10 years ago

It's hard to say this is an issue related to the photo browser without seeing any line of code. Can you provide more info please?

rocxteady commented 10 years ago

I updated the message.

andreagiavatto commented 10 years ago

You are using the wrong UIActionSheetDelegate method in this case. The reason is that when using actionSheet:clickedButtonAtIndex: the action sheet has not been dismissed yet and when it does (after you show the first picture) the photo browser window gets dismissed as well because it is presented too early.

Use this delegate method instead:

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0) {
        [self.browserView showFromIndex:0];
    }
}
rocxteady commented 10 years ago

It shold work with clickedbuttonatindex delegate I think... Because this is how it is used generally. Maybe you will consider it later. Thank you for your help.