File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -592,8 +592,18 @@ - (void)setBackgroundStyle:(TORoundedButtonBackgroundStyle)backgroundStyle {
592592 _backgroundStyle = backgroundStyle;
593593 [_backgroundView removeFromSuperview ];
594594 _backgroundView = [self _makeBackgroundViewWithStyle: _backgroundStyle];
595- [_containerView insertSubview: _backgroundView atIndex: 0 ];
596595 _titleLabel.backgroundColor = [self _labelBackgroundColor ];
596+ const BOOL isGlass = backgroundStyle == TORoundedButtonBackgroundStyleGlass;
597+ if (!isGlass) {
598+ _containerView.hidden = NO ;
599+ [_containerView insertSubview: _backgroundView atIndex: 0 ];
600+ [_containerView addSubview: _contentView];
601+ } else {
602+ UIVisualEffectView *glassView = (UIVisualEffectView *)_backgroundView;
603+ _containerView.hidden = YES ;
604+ [self insertSubview: glassView atIndex: 0 ];
605+ [glassView.contentView addSubview: _contentView];
606+ }
597607 [self setNeedsLayout ];
598608}
599609
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ - (void)viewDidLoad {
2020 // Hide the tapped label
2121 self.tappedLabel .alpha = 0 .0f ;
2222
23+ self.button .backgroundStyle = TORoundedButtonBackgroundStyleGlass;
24+
2325 __weak typeof (self) weakSelf = self;
2426 self.button .tappedHandler = ^{
2527 [weakSelf playFadeAnimationOnView: weakSelf.tappedLabel];
You can’t perform that action at this time.
0 commit comments