From 4ebb108ae11b60e35abcdcb1c7f0084deabe7161 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 28 Jun 2025 15:48:40 +0300 Subject: [PATCH] Fix it harder, remove UIGlassEffect as it's still very buggy --- iOS/GBMenuViewController.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/iOS/GBMenuViewController.m b/iOS/GBMenuViewController.m index e523cf9..8c2f094 100644 --- a/iOS/GBMenuViewController.m +++ b/iOS/GBMenuViewController.m @@ -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]; }