Crazer
Crazer

Reputation: 25

Hide UIActionSheet on iPad

I just got a mail from apple that my iPad app was rejected because my 'app contains popover elements that didn't point to the element that revealed them and more than one popover element visible onscreen at a time'.

The problem is that I call an actionsheet which is still visible when I switch from one view to another and that there can be called to actionsheets at a time. Now I ask myself how I can hide an actionsheet on a view change or when another actionsheet is opend.

Upvotes: 0

Views: 2282

Answers (1)

Nate Abele
Nate Abele

Reputation: 5770

I solved the issue with the sheet showing multiple times when you tap the same button by checking isVisible, as in the following:

- (IBAction) btnFoo: (id) sender
{
    if ([self.sheet isVisible]) {
        [self.sheet dismissWithClickedButtonIndex:self.sheet.cancelButtonIndex animated:YES];
        return;
    }

    [self.sheet showFromBarButtonItem:sender animated:YES];
}

Hope that helps.

Upvotes: 3

Related Questions