Closed GrapeFruitJun closed 4 years ago
麻烦贴出代码我看一下,谢谢
@interface HWSimplePanModalView : HWPanModalContentView
@property (nonatomic, strong) UIVisualEffectView * backgroundBlurView;
@end
@implementation HWSimplePanModalView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
//1.第一种添加毛玻璃
[self addSubview:self.backgroundBlurView];
//2.直接赋值带有透明度的颜色
// self.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:0.5];
}
return self;
}
- (void)layoutSubviews{
[super layoutSubviews];
_backgroundBlurView.frame = self.bounds;
}
- (UIVisualEffectView *)backgroundBlurView{
if (!_backgroundBlurView) {
UIVisualEffect * effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
_backgroundBlurView = [[UIVisualEffectView alloc] initWithEffect:effect];
}
return _backgroundBlurView;
}
// 没起作用
- (HWPanModalShadow)contentShadow {
return PanModalShadowMake([UIColor yellowColor], 10, CGSizeMake(0, 2), 1);
}
// present it.
HWSimplePanModalView *simplePanModalView = [HWSimplePanModalView new];
[simplePanModalView presentInView:nil];
@HeathWang 楼主看到了吗?
@HeathWang 楼主看到了吗?
不好意思,最近比较忙,我看了给你答复
辛苦,麻烦您了
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor yellowColor];
}
return self;
}
- (BOOL)showDragIndicator {
return NO;
}
- (PanModalHeight)longFormHeight {
return PanModalHeightMake(PanModalHeightTypeMaxTopInset, 44);
}
- (CGFloat)topOffset {
return [UIApplication sharedApplication].keyWindow.rootViewController.topLayoutGuide.length + 21;
}
// 以下2个协议方法配置模糊效果
- (CGFloat)backgroundBlurRadius {
return 10;
}
- (UIColor *)backgroundBlurColor {
return [UIColor lightGrayColor];
}
hi, 该框架提供了配置模糊效果的方法,见以上代码
contentShadow不起作用是个bug,暂时无用。 如果你想使用该效果,请使用ViewController
对,UIVisualEffectView失去磨砂效果我也复现了,后续我会排查修复
@GrapeFruitJun UIVisualEffectView加到HWPanModalContentView没有效果在现有的设计下无法解决,我在底层更新了配置,新增了一个方法可以配置系统默认的模糊效果。
/**
* use this object to config background alpha or blur effect
* @return background config object
*/
- (HWBackgroundConfig *)backgroundConfig;
请更新库版本到0.7.0
@GrapeFruitJun 如果没问题,我先关闭该issue了,谢谢
contentShadow不起作用是个bug,暂时无用。 如果你想使用该效果,请使用ViewController
@GrapeFruitJun
🚀 HWPanModal (0.7.1) successfully published 📅 April 24th, 04:34 🌎 https://cocoapods.org/pods/HWPanModal 👍 Tell your friends!
已推荐 @HeathWang 👍
iOS 12.2 继承HWPanModalContentView的自定义View,底部添加 UIVisualEffectView 不起磨玻璃作用 直接变为透明度的图层