Skip to content

Commit

Permalink
完善毛玻璃逻辑:iOS10 下只有无圆角时才使用系统控件
Browse files Browse the repository at this point in the history
  • Loading branch information
yulingtianxia committed Oct 8, 2016
1 parent 33d0a31 commit e678c7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Source/TBActionSheet/TBActionContainer.m
Expand Up @@ -48,7 +48,7 @@ - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event

- (BOOL)useSystemBlurEffect
{
if (kiOS10Later) {
if (kiOS10Later && self.actionSheet.rectCornerRadius > 0) {
return NO;
}
if (kiOS8Later) {
Expand All @@ -66,7 +66,7 @@ - (BOOL)useSystemBlurEffect

- (BOOL)useSystemBlurEffectUnderView:(UIView *)view
{
if (!view || kiOS10Later) {
if (!view || (kiOS10Later && self.actionSheet.rectCornerRadius > 0)) {
return NO;
}
if (kiOS8Later) {
Expand Down
10 changes: 10 additions & 0 deletions Source/TBActionSheet/TBActionSheet.m
Expand Up @@ -511,6 +511,9 @@ - (void)setupStyle
UIImage *backgroundImage = [cutOriginalBackgroundImageInRect(self.actionContainer.header.frame) drn_boxblurImageWithBlur:blurRadius withTintColor:self.ambientColor];
self.actionContainer.header.image = backgroundImage;
}
else {
self.actionContainer.header.image = nil;
}
}
else {
self.actionContainer.header.image = nil;
Expand All @@ -528,6 +531,9 @@ - (void)setupStyle
UIImage *backgroundImage = [cutOriginalBackgroundImageInRect(self.actionContainer.custom.frame) drn_boxblurImageWithBlur:blurRadius withTintColor:self.ambientColor];
self.actionContainer.custom.image = backgroundImage;
}
else {
self.actionContainer.custom.image = nil;
}
}
else {
self.actionContainer.custom.image = nil;
Expand All @@ -550,6 +556,10 @@ - (void)setupStyle
[obj setBackgroundImage:backgroundImageHighlighted forState:UIControlStateHighlighted];
obj.backgroundColor = [UIColor clearColor];
}
else {
[obj setBackgroundImage:nil forState:UIControlStateNormal];
[obj setBackgroundImage:nil forState:UIControlStateHighlighted];
}
}
else {
[obj setBackgroundImage:nil forState:UIControlStateNormal];
Expand Down
6 changes: 5 additions & 1 deletion Source/TBActionSheet/UIView+TBAdditions.m
Expand Up @@ -93,6 +93,10 @@ - (void)setNoneCorner

- (void)setCornerRadius:(CGFloat) radius
{
if (radius == 0) {
[self setNoneCorner];
return;
}
switch (self.tbRectCorner) {
case TBRectCornerTop: {
[self setTopCornerRadius:radius];
Expand All @@ -116,4 +120,4 @@ - (void)setCornerRadius:(CGFloat) radius
}
}

@end
@end

0 comments on commit e678c7a

Please sign in to comment.