diff --git a/TORoundedButton/TORoundedButton.h b/TORoundedButton/TORoundedButton.h index 9572ff4..fc7a1a3 100644 --- a/TORoundedButton/TORoundedButton.h +++ b/TORoundedButton/TORoundedButton.h @@ -89,8 +89,10 @@ IB_DESIGNABLE @interface TORoundedButton : UIControl /// When `backgroundStyle` is set to `.blur`, the specific blur style to apply. @property (nonatomic, assign) UIBlurEffectStyle blurStyle; +#ifdef __IPHONE_26_0 /// When `backgroundStyle` is set to `.glass`, the specific glass style to apply. @property (nonatomic, assign) UIGlassEffectStyle glassStyle API_AVAILABLE(ios(26.0)); +#endif /// The text that is displayed in center of the button (Default is nil). /// This adds an internally controlled label view to the main content view. diff --git a/TORoundedButton/TORoundedButton.m b/TORoundedButton/TORoundedButton.m index 7e474c0..0403421 100644 --- a/TORoundedButton/TORoundedButton.m +++ b/TORoundedButton/TORoundedButton.m @@ -184,6 +184,7 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T if (!TORoundedButtonIsSolidBackground(style)) { // Create a glass or blur style based on the associated style UIVisualEffect *effect = nil; +#ifdef __IPHONE_26_0 if (@available(iOS 26.0, *)) { if (style == TORoundedButtonBackgroundStyleGlass) { UIGlassEffect *const glassEffect = [UIGlassEffect effectWithStyle:_glassStyle]; @@ -191,6 +192,7 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T effect = glassEffect; } } +#endif if (effect == nil) { UIBlurEffect *const blurEffect = [UIBlurEffect effectWithStyle:_blurStyle]; effect = blurEffect; @@ -204,11 +206,15 @@ - (UIView *)_makeBackgroundViewWithStyle:(TORoundedButtonBackgroundStyle)style T backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; backgroundView.clipsToBounds = !TORoundedButtonIsSolidBackground(style); +#ifdef __IPHONE_26_0 if (@available(iOS 26.0, *)) { backgroundView.cornerConfiguration = _cornerConfiguration; } else { backgroundView.layer.cornerRadius = _cornerRadius; } +#else + backgroundView.layer.cornerRadius = _cornerRadius; +#endif #ifdef __IPHONE_13_0 if (@available(iOS 13.0, *)) { backgroundView.layer.cornerCurve = kCACornerCurveContinuous; } @@ -613,6 +619,7 @@ - (void)setBlurStyle:(UIBlurEffectStyle)blurStyle { [blurView setEffect:[UIBlurEffect effectWithStyle:_blurStyle]]; } +#ifdef __IPHONE_26_0 - (void)setGlassStyle:(UIGlassEffectStyle)glassStyle { if (_glassStyle == glassStyle) { return; } _glassStyle = glassStyle; @@ -627,6 +634,7 @@ - (void)setGlassStyle:(UIGlassEffectStyle)glassStyle { UIVisualEffectView *const effectView = (UIVisualEffectView *)_backgroundView; [effectView setEffect:glassEffect]; } +#endif - (void)setEnabled:(BOOL)enabled { [super setEnabled:enabled];