Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions WYPopoverController/WYPopoverController.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
@property (nonatomic, assign) UIEdgeInsets viewContentInsets UI_APPEARANCE_SELECTOR;

@property (nonatomic, strong) UIColor *overlayColor UI_APPEARANCE_SELECTOR;

@end

////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -102,7 +101,7 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
@property (nonatomic, strong, readonly) UIViewController *contentViewController;
@property (nonatomic, assign) CGSize popoverContentSize;
@property (nonatomic, assign) float animationDuration;

@property (nonatomic, assign, getter = isOverlayEnabled) BOOL overlayEnabled;
@property (nonatomic, strong) WYPopoverTheme *theme;

+ (void)setDefaultTheme:(WYPopoverTheme *)theme;
Expand Down Expand Up @@ -246,6 +245,7 @@ typedef NS_OPTIONS(NSUInteger, WYPopoverAnimationOptions) {
@property (nonatomic, assign) UIEdgeInsets viewContentInsets;

@property (nonatomic, strong) UIColor *overlayColor;
@property (nonatomic, readwrite) CGFloat visibleAlpha;

+ (instancetype)theme;
+ (instancetype)themeForIOS6;
Expand Down
22 changes: 15 additions & 7 deletions WYPopoverController/WYPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ of this software and associated documentation files (the "Software"), to deal
#define WY_BASE_SDK_7_ENABLED
#endif

#ifdef DEBUG
#if defined(DEBUG) && !WYPOPOVER_NOLOG
#define WY_LOG(fmt, ...) NSLog((@"%s (%d) : " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define WY_LOG(...)
Expand Down Expand Up @@ -433,6 +433,7 @@ @implementation WYPopoverTheme
@synthesize viewContentInsets;

@synthesize overlayColor;
@synthesize visibleAlpha;

+ (id)theme {

Expand Down Expand Up @@ -473,6 +474,7 @@ + (id)themeForIOS6 {
result.innerCornerRadius = 6;
result.viewContentInsets = UIEdgeInsetsMake(3, 0, 0, 0);
result.overlayColor = [UIColor clearColor];
result.visibleAlpha = 1.0f;

return result;
}
Expand Down Expand Up @@ -503,7 +505,8 @@ + (id)themeForIOS7 {
result.innerCornerRadius = 0;
result.viewContentInsets = UIEdgeInsetsZero;
result.overlayColor = [UIColor colorWithWhite:0 alpha:0.15];

result.visibleAlpha = 1.0f;

return result;
}

Expand Down Expand Up @@ -595,7 +598,8 @@ - (UIColor *)fillBottomColor
}

- (NSArray *)observableKeypaths {
return [NSArray arrayWithObjects:@"tintColor", @"outerStrokeColor", @"innerStrokeColor", @"fillTopColor", @"fillBottomColor", @"glossShadowColor", @"glossShadowOffset", @"glossShadowBlurRadius", @"borderWidth", @"arrowBase", @"arrowHeight", @"outerShadowColor", @"outerShadowBlurRadius", @"outerShadowOffset", @"outerCornerRadius", @"innerShadowColor", @"innerShadowBlurRadius", @"innerShadowOffset", @"innerCornerRadius", @"viewContentInsets", @"overlayColor", nil];
return [NSArray arrayWithObjects:@"tintColor", @"outerStrokeColor", @"innerStrokeColor", @"fillTopColor", @"fillBottomColor", @"glossShadowColor", @"glossShadowOffset", @"glossShadowBlurRadius", @"borderWidth", @"arrowBase", @"arrowHeight", @"outerShadowColor", @"outerShadowBlurRadius", @"outerShadowOffset", @"outerCornerRadius", @"innerShadowColor", @"innerShadowBlurRadius", @"innerShadowOffset", @"innerCornerRadius", @"viewContentInsets", @"overlayColor",
@"visibleAlpha", nil];
}

@end
Expand Down Expand Up @@ -1684,6 +1688,7 @@ - (id)init
themeUpdatesEnabled = YES;

popoverContentSize_ = CGSizeZero;
self.overlayEnabled = YES;
}

return self;
Expand Down Expand Up @@ -1935,7 +1940,9 @@ - (void)presentPopoverFromRect:(CGRect)aRect
backgroundView.hidden = YES;

[inView.window addSubview:backgroundView];
[inView.window insertSubview:overlayView belowSubview:backgroundView];
if( self.isOverlayEnabled ) {
[inView.window insertSubview:overlayView belowSubview:backgroundView];
}
}

[self updateThemeUI];
Expand Down Expand Up @@ -2014,8 +2021,8 @@ - (void)presentPopoverFromRect:(CGRect)aRect

if (strongSelf)
{
strongSelf->overlayView.alpha = 1;
strongSelf->backgroundView.alpha = 1;
strongSelf->overlayView.alpha = theme.visibleAlpha;
strongSelf->backgroundView.alpha = theme.visibleAlpha;
strongSelf->backgroundView.transform = endTransform;
}
adjustTintDimmed();
Expand Down Expand Up @@ -2935,7 +2942,7 @@ - (CGSize)sizeForRect:(CGRect)aRect
}

#pragma mark Inline functions

#if 0
static NSString* WYStringFromOrientation(NSInteger orientation) {
NSString *result = @"Unknown";

Expand All @@ -2958,6 +2965,7 @@ - (CGSize)sizeForRect:(CGRect)aRect

return result;
}
#endif

static float WYStatusBarHeight() {
UIInterfaceOrientation orienation = [[UIApplication sharedApplication] statusBarOrientation];
Expand Down