Question: I want to dismiss `UIActionsheet` when user taps anywhere else on screen. I don't want to 
provide cancel button.

**My code**

```
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:sheetTitle delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles: nil];

    [sheet setTag:indexPath.row];

    for (NSString *buttonTitle in buttonTitles)
    {
        [sheet addButtonWithTitle:buttonTitle];
    }

    [sheet showFromToolbar:self.navigationController.toolbar];

    [sheet release];
    [buttonTitles release];

```

Answer: 
try this

```
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOut:)];
tap.cancelsTouchesInView = NO;
[actionSheet.window addGestureRecognizer:tap];
[tap release];`<br> `-(void)tapOut:(UIGestureRecognizer *)gestureRecognizer {
CGPoint p = [gestureRecognizer locationInView:self.actionSheet];

if (p.y < 0) {
  [actionSheet dismissWithClickedButtonIndex:0 animated:YES];
}
}

```
Declare ActionSheet globally and then paste this code after the viewdidload

```
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

        [super touchesBegan:touches withEvent:event];
        [actionSheet dismissWithClickedButtonIndex:0 animated:YES];
    }

```

works 100%