Fix it harder, remove UIGlassEffect as it's still very buggy

This commit is contained in:
Lior Halphon 2025-06-28 15:48:40 +03:00
parent d1da91da7c
commit 4ebb108ae1
1 changed files with 11 additions and 4 deletions

View File

@ -53,6 +53,7 @@ static NSString *const tips[] = {
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:true];
if (_effectView) return;
static const struct {
NSString *label;
NSString *image;
@ -110,10 +111,12 @@ static NSString *const tips[] = {
[self updateSelectedButton];
UIVisualEffect *effect = nil;
/*
// Unfortunately, UIGlassEffect is still very buggy.
if (@available(iOS 19.0, *)) {
effect = [[objc_getClass("UIGlassEffect") alloc] init];
}
else {
else */ {
effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleProminent];
}
@ -134,17 +137,19 @@ static NSString *const tips[] = {
_tipLabel.numberOfLines = 3;
[_effectView.contentView addSubview:_tipLabel];
[self layoutTip];
_effectView.alpha = 0;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
_effectView.alpha = 1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.25 animations:^{
_effectView.alpha = 1.0;
}];
});
}
- (void)layoutTip
{
[self.view.window addSubview:_effectView];
[_effectView.superview addSubview:_effectView];
UIView *view = self.view.superview;
CGSize outerSize = view.frame.size;
CGSize size = [_tipLabel textRectForBounds:(CGRect){{0, 0},
@ -164,6 +169,8 @@ static NSString *const tips[] = {
{
[UIView animateWithDuration:0.25 animations:^{
_effectView.alpha = 0;
} completion:^(BOOL finished) {
[_effectView removeFromSuperview];
}];
[super viewWillDisappear:animated];
}