Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show an action sheet inside the popover?

I have a split View controller, in which the left side holds a table view controller. How do I show an action sheet inside the popover when I click on the detail disclosure button of the table cell?

like image 811
Shweta Avatar asked May 17 '10 09:05

Shweta


1 Answers

Try this :

UIActionSheet *popupSheet = [[UIActionSheet alloc] initWithTitle:@"Title" 
                                                        delegate:self 
                                               cancelButtonTitle:@"Cancel" 
                                          destructiveButtonTitle:@"No Way !" 
                                               otherButtonTitles:nil];

popupSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
UIButton * disclosureButton = (UIButton *)cell.accessoryView;

[popupSheet showFromRect:disclosureButton.bounds inView:cell.accessoryView animated:YES];
[popupSheet release];

The UIActionSheet docs state that the showFromRect:inView:animated: method:

displays the action sheet in a popover whose arrow points to the specified rectangle of the view (in our case the detail disclosure button). The popover does not overlap the specified rectangle.

like image 57
Ibrahim Abdulkarim Avatar answered Nov 18 '22 06:11

Ibrahim Abdulkarim