From c3d67f316b134d22b9377deb110638437f9ca356 Mon Sep 17 00:00:00 2001 From: Tom Li Date: Fri, 18 Oct 2013 10:53:27 +0800 Subject: [PATCH] Add popoverViewWillDismiss delegate method --- PopoverView/PopoverView.h | 5 ++++- PopoverView/PopoverView.m | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/PopoverView/PopoverView.h b/PopoverView/PopoverView.h index 5ff782b..55eab73 100644 --- a/PopoverView/PopoverView.h +++ b/PopoverView/PopoverView.h @@ -69,9 +69,12 @@ //Delegate receives this call as soon as the item has been selected - (void)popoverView:(PopoverView *)popoverView didSelectItemAtIndex:(NSInteger)index; -//Delegate receives this call once the popover has begun the dismissal animation +//Delegate receives this call once the popover has finished the dismissal animation - (void)popoverViewDidDismiss:(PopoverView *)popoverView; +//Delegate receives this call once the popover has begun the dismissal animation +- (void)popoverViewWillDismiss:(PopoverView *)popoverView; + @end @interface PopoverView : UIView { diff --git a/PopoverView/PopoverView.m b/PopoverView/PopoverView.m index 1bf43b5..a5dd650 100644 --- a/PopoverView/PopoverView.m +++ b/PopoverView/PopoverView.m @@ -815,6 +815,10 @@ - (void)dismiss - (void)dismiss:(BOOL)animated { + if (self.delegate && [self.delegate respondsToSelector:@selector(popoverViewWillDismiss:)]) { + [delegate popoverViewWillDismiss:self]; + } + if (!animated) { [self dismissComplete];