Salman Zaidi
Salman Zaidi

Reputation: 9842

UIActionSheet in iPad appears with arrow on bottom

I am adding a UIActionSheet control on button click within UITableViewCells. The action sheet appears with downward arrow always unless until there is less space available above the bounding view.

I want the actionsheet to appear below the bounding view whenever there's space available.

Anyone knows any solution to make the default appearance of UIActionSheet with upward arrow?

Here is the code of adding UIActionSheet which is btw working fine:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                         delegate:self
                                                cancelButtonTitle:@"Cancel"
                                           destructiveButtonTitle:nil
                                                otherButtonTitles:@"Edit", @"Delete", @"New", @"Copy", nil];

[actionSheet showFromRect:[self.headerView bounds]
                   inView:self.contentView
                 animated:YES];

Upvotes: 1

Views: 689

Answers (2)

Akhil K C
Akhil K C

Reputation: 4553

UIActionSheet is deprecated in iOS 8. To create and manage action sheets in iOS 8 and later, instead use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet. You can use UIPopoverPresentationController and its permittedArrowDirections to set the arrow direction.

Upvotes: 1

George Petrov
George Petrov

Reputation: 163

Check this section in the UIActionSheet Documentation. If that does not works for you, you can always create a custom UIView with custom content :)

Upvotes: 0

Related Questions