Skip to content

Commit

Permalink
Added completion block after presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaschengdev committed Feb 15, 2014
1 parent 9346b41 commit 2e70efd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
16 changes: 15 additions & 1 deletion WYPopoverController/WYPopoverController.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Version 0.1.8
Version 0.1.9
WYPopoverController is available under the MIT license.
Expand Down Expand Up @@ -135,14 +135,28 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
completion:(void (^)(void))completion;


//

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item
permittedArrowDirections:(WYPopoverArrowDirection)arrowDirections
animated:(BOOL)animated
options:(WYPopoverAnimationOptions)options;

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item
permittedArrowDirections:(WYPopoverArrowDirection)arrowDirections
animated:(BOOL)animated
options:(WYPopoverAnimationOptions)options
completion:(void (^)(void))completion;

//

- (void)presentPopoverAsDialogAnimated:(BOOL)animated
options:(WYPopoverAnimationOptions)options;

- (void)presentPopoverAsDialogAnimated:(BOOL)animated
options:(WYPopoverAnimationOptions)options
completion:(void (^)(void))completion;

//

- (void)dismissPopoverAnimated:(BOOL)animated;
Expand Down
40 changes: 32 additions & 8 deletions WYPopoverController/WYPopoverController.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Version 0.1.8
Version 0.1.9
WYPopoverController is available under the MIT license.
Expand Down Expand Up @@ -1708,29 +1708,53 @@ - (void)presentPopoverFromRect:(CGRect)aRect
overlayView.isAccessibilityElement = YES;
}

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item
permittedArrowDirections:(WYPopoverArrowDirection)arrowDirections
- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)aItem
permittedArrowDirections:(WYPopoverArrowDirection)aArrowDirections
animated:(BOOL)aAnimated
options:(WYPopoverAnimationOptions)aOptions
{
barButtonItem = item;
[self presentPopoverFromBarButtonItem:aItem
permittedArrowDirections:aArrowDirections
animated:aAnimated
options:aOptions
completion:nil];
}

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)aItem
permittedArrowDirections:(WYPopoverArrowDirection)aArrowDirections
animated:(BOOL)aAnimated
options:(WYPopoverAnimationOptions)aOptions
completion:(void (^)(void))completion
{
barButtonItem = aItem;
UIView *itemView = [barButtonItem valueForKey:@"view"];
arrowDirections = WYPopoverArrowDirectionDown | WYPopoverArrowDirectionUp;
aArrowDirections = WYPopoverArrowDirectionDown | WYPopoverArrowDirectionUp;
[self presentPopoverFromRect:itemView.bounds
inView:itemView
permittedArrowDirections:arrowDirections
permittedArrowDirections:aArrowDirections
animated:aAnimated
options:aOptions];
options:aOptions
completion:completion];
}

- (void)presentPopoverAsDialogAnimated:(BOOL)aAnimated
options:(WYPopoverAnimationOptions)aOptions
{
[self presentPopoverAsDialogAnimated:aAnimated
options:aOptions
completion:nil];
}

- (void)presentPopoverAsDialogAnimated:(BOOL)aAnimated
options:(WYPopoverAnimationOptions)aOptions
completion:(void (^)(void))completion
{
[self presentPopoverFromRect:CGRectZero
inView:nil
permittedArrowDirections:WYPopoverArrowDirectionNone
animated:aAnimated
options:aOptions];
options:aOptions
completion:completion];
}

- (CGAffineTransform)transformTranslateForArrowDirection:(WYPopoverArrowDirection)arrowDirection
Expand Down
2 changes: 1 addition & 1 deletion WYPopoverController/WYStoryboardPopoverSegue.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Version 0.1.8
Version 0.1.9
WYPopoverController is available under the MIT license.
Expand Down
2 changes: 1 addition & 1 deletion WYPopoverController/WYStoryboardPopoverSegue.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Version 0.1.8
Version 0.1.9
WYPopoverController is available under the MIT license.
Expand Down

0 comments on commit 2e70efd

Please sign in to comment.