3
votes

I created UITabbar in UIViewController. Then i added a UIActionSheet to it but when the actionsheet appeared, when top part of button "Cancel" is clicked, it works, but when I click the bottom part of "Cancel", there's no response. I used this code to add the actionsheet:

actionSheetDelete = [[UIActionSheet alloc] initWithTitle:@"Do you want to continue?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete Item(s)" otherButtonTitles:nil];
actionSheetDelete.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheetDelete showInView:self.view];
[actionSheetDelete release];

When i click on action sheet, i always show this alarm in console:

Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

Do you have any suggestion? Thanks in advance

3

3 Answers

2
votes

Try:

[actionSheetDelete showFromTabBar:self.tabBarController.tabBar];
1
votes

You could show it in the view of the UITabBarController:

actionSheetDelete = [[UIActionSheet alloc] initWithTitle:@"Do you want to continue?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete Item(s)" otherButtonTitles:nil];
actionSheetDelete.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheetDelete showInView:self.tabBarController.view];
[actionSheetDelete release];

Alternatively, a slightly more robust version might be:

[actionSheetDelete showInView:[UIApplication sharedApplication].keyWindow];
0
votes

You are trying to show the action sheet from the view itself. This cannot be done considering you have the UITabBarController inside the view already. Therefore, you have to set it from the tab bar when it is shown. This will ensure that the buttons are not loaded underneath the view of the tab bar, and allow the availability of all the actions associated with the tab bar.

Therefore, you should use

[actionSheetDelete showFromTabBar:];

so that the tab bar is the initial location of where the action sheet is shown Hope this helps!