0

I have a horizontally scrolling UITableView on the bottom of my iPad app, and when the user taps on one of the cells, I pop up a UIActionSheet from it allowing them to select between two options.

That part works fine, but I'm running into two UI problems when dismissing the actionsheet.

1) When the user clicks outside of the UIActionSheet and not a different UITableViewCell, I'd like to deselect that cell immediately and then dismiss the UIActionSheet, or fade them both out at the same time. However, when I implement

  • (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex

to do this, it still results in the actionsheet slowly fading out before deselecting the cell, which just looks a little odd. It happens whether I'm calling [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:NO], by getting that cell and changing the appearance manually, or reloading the table. Even if I maintain a reference to the UIActionSheet from when I create it (e.g. self.actionSheet) and set it to hidden or nil when willDismissWithButtonIndex is called, it still operates this way.

2) If the user clicks outside the UIActionSheet but selects another TableViewCell, I'd like to instantly shift the UIActionSheet to the other cell. Right now, however, it just fades out slowly and then the user has to tap the new cell again in order to bring up the UIActionSheet for that cell.

Anyone have suggestions or experience with this issue?

All the best,

Toby

Toby
  • 390
  • 4
  • 18

1 Answers1

0

From the UIActionSheet class reference:

For applications running on iPad devices, the action sheet is typically displayed in a popover that is anchored to the starting view in an appropriate way. Taps outside of the popover automatically dismiss the action sheet, as do taps within any custom buttons. You can also dismiss it programmatically.

So I do not think you can change the behaviour of this UIActionSheet when user taps outside to select another cell in your app. You might want to just create your custom pop over view to address your two issues.

Valent Richie
  • 5,226
  • 1
  • 20
  • 21