Skip to content

Commit cad07d1

Browse files
fix issue #55
1 parent 96c2c6d commit cad07d1

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

WYPopoverController/WYPopoverController.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,18 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
9696

9797
@property (nonatomic, weak) id <WYPopoverControllerDelegate> delegate;
9898

99-
@property (nonatomic, copy) NSArray *passthroughViews;
100-
@property (nonatomic, assign) BOOL wantsDefaultContentAppearance;
101-
@property (nonatomic, assign) UIEdgeInsets popoverLayoutMargins;
102-
@property (nonatomic, assign, readonly) BOOL isPopoverVisible;
103-
@property (nonatomic, strong, readonly) UIViewController* contentViewController;
104-
@property (nonatomic, assign) CGSize popoverContentSize;
99+
@property (nonatomic, copy) NSArray *passthroughViews;
100+
@property (nonatomic, assign) BOOL wantsDefaultContentAppearance;
101+
@property (nonatomic, assign) UIEdgeInsets popoverLayoutMargins;
102+
@property (nonatomic, assign, readonly) BOOL isPopoverVisible;
103+
@property (nonatomic, strong, readonly) UIViewController *contentViewController;
104+
@property (nonatomic, assign) CGSize popoverContentSize;
105+
@property (nonatomic, assign) CGFloat animationDuration;
105106

106107
- (id)initWithContentViewController:(UIViewController *)viewController;
107108

109+
//
110+
108111
- (void)presentPopoverFromRect:(CGRect)rect
109112
inView:(UIView *)view
110113
permittedArrowDirections:(WYPopoverArrowDirection)arrowDirections
@@ -116,6 +119,8 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
116119

117120
- (void)presentPopoverAsDialogAnimated:(BOOL)animated;
118121

122+
//
123+
119124
- (void)presentPopoverFromRect:(CGRect)rect
120125
inView:(UIView *)view
121126
permittedArrowDirections:(WYPopoverArrowDirection)arrowDirections
@@ -130,6 +135,8 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
130135
- (void)presentPopoverAsDialogAnimated:(BOOL)animated
131136
options:(WYPopoverAnimationOptions)options;
132137

138+
//
139+
133140
- (void)dismissPopoverAnimated:(BOOL)animated;
134141

135142
@end

WYPopoverController/WYPopoverController.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,7 @@ @implementation WYPopoverController
13721372
@synthesize wantsDefaultContentAppearance;
13731373
@synthesize isPopoverVisible;
13741374
@synthesize popoverLayoutMargins;
1375+
@synthesize animationDuration;
13751376

13761377
- (id)initWithContentViewController:(UIViewController *)aViewController
13771378
{
@@ -1382,6 +1383,7 @@ - (id)initWithContentViewController:(UIViewController *)aViewController
13821383
viewController = aViewController;
13831384
popoverLayoutMargins = UIEdgeInsetsMake(10, 10, 10, 10);
13841385
keyboardRect = CGRectZero;
1386+
animationDuration = WY_POPOVER_DEFAULT_ANIMATION_DURATION;
13851387
}
13861388

13871389
return self;
@@ -1598,7 +1600,7 @@ - (void)presentPopoverFromRect:(CGRect)aRect
15981600
containerView.transform = startTransform;
15991601
}
16001602

1601-
[UIView animateWithDuration:WY_POPOVER_DEFAULT_ANIMATION_DURATION animations:^{
1603+
[UIView animateWithDuration:animationDuration animations:^{
16021604
overlayView.alpha = 1;
16031605
containerView.alpha = 1;
16041606
containerView.transform = endTransform;
@@ -2028,7 +2030,7 @@ - (void)dismissPopoverAnimated:(BOOL)aAnimated callDelegate:(BOOL)callDelegate
20282030

20292031
if (aAnimated)
20302032
{
2031-
[UIView animateWithDuration:WY_POPOVER_DEFAULT_ANIMATION_DURATION animations:^{
2033+
[UIView animateWithDuration:animationDuration animations:^{
20322034
overlayView.alpha = 0;
20332035
} completion:^(BOOL finished) {
20342036
[overlayView removeFromSuperview];
@@ -2084,7 +2086,7 @@ - (void)dismissPopoverAnimated:(BOOL)aAnimated callDelegate:(BOOL)callDelegate
20842086

20852087
if (aAnimated)
20862088
{
2087-
[UIView animateWithDuration:WY_POPOVER_DEFAULT_ANIMATION_DURATION animations:^{
2089+
[UIView animateWithDuration:animationDuration animations:^{
20882090
containerView.alpha = 0;
20892091
} completion:^(BOOL finished) {
20902092
completionBlock(finished);

0 commit comments

Comments
 (0)