I was getting problems displaying an action sheet in a view that was contained within a tab control.
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure you wish to continue?" delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil]; [sheet showInView:self.view]; [sheet release];
The prompt would be displayed but the clicking of the “No” button didn’t always work. The problem is although there is a view that can display the prompt, the correct view to do it is the tab bar, The following code works fine
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure you wish to continue?" delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Yes" otherButtonTitles:nil]; [sheet showFromTabBar:self.tabBarController.tabBar]; [sheet release];
[sheet showInView:self.tabBarController.view];
Makzzz, I assume either will work just as well
Thanks very much! works awesome.