我有一个 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;
}
这些按钮必须经常移动(平移)、调整大小和缩放,当我执行这些操作时,模糊消失并变成半透明视图。如果我使用 CGAffineTransformation 的框架/中心移动,就会发生这种情况。
有没有办法治愈这个?