Reputation: 9376
So I set up my storyboard files and whatnot and made an action for my UIBarButton. In this method I create an action sheet and display it. But it seems no matter what I do it always displays from the bottom. Can't you get it to pop down from the navbar with a little arrow in the border that points to the button you clicked? Well, I'm having trouble finding the right method. Here's what I have tried:
- (IBAction)actionBtnPressed:(UIBarButtonItem *)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Options" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Report User" otherButtonTitles: nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showFromBarButtonItem:sender animated:YES];
}
I have also tried
[actionSheet showFromToolbar:self.navigationController.toolbar];
instead of showFromBarButtonItem, but these methods aren't reading my mind that I want it to display from the button. Any ideas?
Upvotes: 2
Views: 1402
Reputation: 23278
For an iPhone, actionsheet is always displayed from bottom of the screen. What you meant is a UIPopover
which is available only for an iPad. However, you can use a custom popover if you want to use the same feature in your app. Check WEPopover. It allows you to create pop over in iPhone and it can be safely used to draw popover in your app. You can show the required items inside this popover.
Upvotes: 1