@@ -55,7 +55,7 @@ @implementation TORoundedButton {
5555#pragma mark - View Creation -
5656
5757- (instancetype )init {
58- if (self = [self initWithFrame: (CGRect){0 ,0 , 288 .0f , 50 .0f }]) { }
58+ if (self = [self initWithFrame: (CGRect){0 ,0 , 288 .0f , 44 .0f }]) { }
5959 return self;
6060}
6161
@@ -86,7 +86,7 @@ - (instancetype)initWithContentView:(__kindof UIView *)contentView {
8686}
8787
8888- (instancetype )initWithText : (NSString *)text {
89- if (self = [super initWithFrame: (CGRect){0 ,0 , 288 .0f , 50 .0f }]) {
89+ if (self = [super initWithFrame: (CGRect){0 ,0 , 288 .0f , 44 .0f }]) {
9090 _contentView = [UIView new ];
9191 [self _roundedButtonCommonInit ];
9292 [self _makeTitleLabelIfNeeded ];
@@ -99,7 +99,6 @@ - (instancetype)initWithText:(NSString *)text {
9999
100100- (void )_roundedButtonCommonInit TOROUNDEDBUTTON_OBJC_DIRECT {
101101 // Default properties (Make sure they're not overriding IB)
102- _cornerRadius = (_cornerRadius > FLT_EPSILON) ?: 12 .0f ;
103102 _tappedTextAlpha = (_tappedTextAlpha > FLT_EPSILON) ?: 1 .0f ;
104103 _tapAnimationDuration = (_tapAnimationDuration > FLT_EPSILON) ?: 0 .4f ;
105104 _tappedButtonScale = (_tappedButtonScale > FLT_EPSILON) ?: 0 .97f ;
@@ -133,6 +132,13 @@ - (void)_roundedButtonCommonInit TOROUNDEDBUTTON_OBJC_DIRECT {
133132 [self addTarget: self action: @selector (_didTouchUpInside ) forControlEvents: UIControlEventTouchUpInside];
134133 [self addTarget: self action: @selector (_didDragOutside ) forControlEvents: UIControlEventTouchDragExit|UIControlEventTouchCancel];
135134 [self addTarget: self action: @selector (_didDragInside ) forControlEvents: UIControlEventTouchDragEnter];
135+
136+ // Set the corner radius depending on app version
137+ if (@available (iOS 26.0 , *)) {
138+ self.cornerConfiguration = [UICornerConfiguration capsuleConfiguration ];
139+ } else {
140+ _cornerRadius = (_cornerRadius > FLT_EPSILON) ?: 12 .0f ;
141+ }
136142}
137143
138144- (void )_makeTitleLabelIfNeeded TOROUNDEDBUTTON_OBJC_DIRECT {
@@ -166,7 +172,6 @@ - (UIView *)_makeBackgroundViewWithBlur:(BOOL)withBlur TOROUNDEDBUTTON_OBJC_DIRE
166172 }
167173 backgroundView.frame = self.bounds ;
168174 backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
169- backgroundView.layer .cornerRadius = _cornerRadius;
170175#ifdef __IPHONE_13_0
171176 if (@available (iOS 13.0 , *)) { backgroundView.layer .cornerCurve = kCACornerCurveContinuous ; }
172177#endif
@@ -511,12 +516,26 @@ - (void)setCornerRadius:(CGFloat)cornerRadius {
511516 if (fabs (cornerRadius - _cornerRadius) < FLT_EPSILON) {
512517 return ;
513518 }
514-
519+
515520 _cornerRadius = cornerRadius;
516- _backgroundView.layer .cornerRadius = _cornerRadius;
521+
522+ if (@available (iOS 26.0 , *)) {
523+ UICornerRadius *const radius = [UICornerRadius fixedRadius: _cornerRadius];
524+ _backgroundView.cornerConfiguration = [UICornerConfiguration configurationWithUniformRadius: radius];
525+ } else {
526+ _backgroundView.layer .cornerRadius = _cornerRadius;
527+ }
517528 [self setNeedsLayout ];
518529}
519530
531+ - (void )setCornerConfiguration : (UICornerConfiguration *)cornerConfiguration {
532+ _backgroundView.cornerConfiguration = cornerConfiguration;
533+ }
534+
535+ - (UICornerConfiguration *)cornerConfiguration {
536+ return _backgroundView.cornerConfiguration ;
537+ }
538+
520539- (void )setIsTranslucent : (BOOL )isTranslucent {
521540 if (_isTranslucent == isTranslucent) {
522541 return ;
0 commit comments