iOS开发精选iOS 开源库问题Obj-C

MBProgressHud实现透明效果

2017-05-12  本文已影响743人  韦德460

将MBProgressHUD.m文件中第1164行代码注释
注释不会对其他代码有影响,只是取消了毛玻璃效果

- (void)updateForBackgroundStyle {
    MBProgressHUDBackgroundStyle style = self.style;
    if (style == MBProgressHUDBackgroundStyleBlur) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 || TARGET_OS_TV
        if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0) {
            UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
            UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
            // 注释下面这行代码,否则即使设置self.alpha,也会被effectView挡住
            // [self addSubview:effectView];
            effectView.frame = self.bounds;
            effectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
            self.backgroundColor = self.color;
            self.layer.allowsGroupOpacity = NO;
            self.effectView = effectView;
        } else {
#endif


强烈推荐:超简单!!! iOS设置状态栏、导航栏按钮、标题、颜色、透明度,偏移等

https://github.com/wangrui460/WRNavigationBar
https://github.com/wangrui460/WRNavigationBar_swift



欢迎关注我的微博:wangrui460

上一篇 下一篇

猜你喜欢

热点阅读