Created
June 14, 2013 12:12
-
-
Save monjer/5781348 to your computer and use it in GitHub Desktop.
继承UIPopoverController,实现在popover在dismiss时自动调用代理方法,默认情况下通过dismissPopoverAnimated:方法来清除popover时,不会调用代理的方法。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // MMPopoverController.h | |
| // Animation | |
| // | |
| // Created by manjun.han on 04/06/2013. | |
| // Copyright (c) 2013 animation. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> | |
| @interface MMPopoverController : UIPopoverController | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // MMPopoverController.m | |
| // Animation | |
| // | |
| // Created by manjun.han on 04/06/2013. | |
| // Copyright (c) 2013 animation. All rights reserved. | |
| // | |
| #import "MMPopoverController.h" | |
| @implementation MMPopoverController | |
| - (void)dismissPopoverAnimated:(BOOL)animated | |
| { | |
| if ([self.delegate respondsToSelector:@selector(popoverControllerShouldDismissPopover:)]) { | |
| if (![self.delegate popoverControllerShouldDismissPopover:self]) { | |
| return ; | |
| } | |
| } | |
| [super dismissPopoverAnimated:animated]; | |
| if ([self.delegate respondsToSelector:@selector(popoverControllerDidDismissPopover:)]) { | |
| [self.delegate popoverControllerDidDismissPopover:self]; | |
| } | |
| } | |
| @end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment