iOS 8 UIVisualEffect UIBlurEffect 和缩放/移动/调整大小

标签 ios cgaffinetransform uiblureffect uivisualeffectview

我有一个 UIButton 的子类,我正在对其进行模糊处理,它看起来很棒:

- (id)initWithFrame:(CGRect)frame
    {
        if (self = [super initWithFrame:frame])
        {
            self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.0];
            UIVisualEffect *blurEffect;
            blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];

            UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
            visualEffectView.frame = self.bounds;

            [self insertSubview:visualEffectView atIndex:0];
            visualEffectView.userInteractionEnabled = NO;

            self.layer.cornerRadius = 23.8;
            self.clipsToBounds = YES;

            self.titleLabel.font = [UIFont fontWithName:@"DINCondensed-Bold" size:15.0];
        }
        return self;
    }

这些按钮必须经常移动(平移)、调整大小和缩放,当我执行这些操作时,模糊消失并变成半透明 View 。如果我使用框架/中心移动,使用 CGAffineTransformation,就会发生这种情况。

有什么办法可以解决吗?

最佳答案

这个问题的一个解决方案是检测设备何时改变方向并生成模糊效果并每次更新约束

关于iOS 8 UIVisualEffect UIBlurEffect 和缩放/移动/调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27178982/

相关文章:

ios - UITableView 模糊叠加

swift - UIBlurEffect View 不覆盖背景图片

ios - 具有相同扇区的多种颜色的 UIView 边框

iphone - 命令/usr/sbin/chown 失败,退出代码为 1

ios - 在导航中使用 View Controller 添加 3D 触摸动态快速操作

ios - 呈现具有模糊效果的 View Controller

java - 打开应用程序和服务器之间的连接

ios - UILabel 文本在应用缩放变换时被压缩/拉伸(stretch)

objective-c - 使用 CGAffineTransform 在 View 上应用缩放和旋转

iOS:同步缩放和 3D 旋转动画