Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the ability to show an action sheet with a custom UIPopoverArrowD... #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SIActionSheet/SIActionSheet.h
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ typedef void(^SIActionSheetDismissHandler)(SIActionSheet *actionSheet, NSInteger

- (void)show;
- (void)showFromRect:(CGRect)rect inView:(UIView *)view;
- (void)showFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections;
- (void)dismissWithButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated; // (buttonIndex == -1) means no button is clicked.

@end
7 changes: 6 additions & 1 deletion SIActionSheet/SIActionSheet.m
Original file line number Diff line number Diff line change
@@ -273,6 +273,11 @@ - (void)show
}

- (void)showFromRect:(CGRect)rect inView:(UIView *)view
{
[self showFromRect:rect inView:view permittedArrowDirections:UIPopoverArrowDirectionAny];
}

- (void)showFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections
{
if (self.isVisible) {
return;
@@ -290,7 +295,7 @@ - (void)showFromRect:(CGRect)rect inView:(UIView *)view
self.popoverController.delegate = self;
self.popoverController.popoverBackgroundViewClass = [SIPopoverBackgroundView class];

[self.popoverController presentPopoverFromRect:rect inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[self.popoverController presentPopoverFromRect:rect inView:view permittedArrowDirections:arrowDirections animated:YES];

// tweak ui for popover
self.backgroundView.hidden = YES;