diff --git a/Objective-C/TOCropViewController/TOCropViewController.m b/Objective-C/TOCropViewController/TOCropViewController.m index d26e1ba4..4e5d1ef5 100755 --- a/Objective-C/TOCropViewController/TOCropViewController.m +++ b/Objective-C/TOCropViewController/TOCropViewController.m @@ -286,7 +286,11 @@ - (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout CGRect frame = CGRectZero; if (!verticalLayout) { // In landscape laying out toolbar to the left if (@available(iOS 26.0, *)) { +#if !TARGET_OS_VISION CGFloat minPadding = 8.0f; +#else + CGFloat minPadding = 16.0f; +#endif frame.origin.x = insets.left + minPadding; frame.origin.y = minPadding; frame.size.width = kTOCropViewControllerToolbarHeight; @@ -314,6 +318,7 @@ - (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout insets.bottom = 8.0f; } +#if !TARGET_OS_VISION const char* components[] = {"Radius", "Corner", "display", "_"}; NSString *selectorName = @""; for (NSInteger i = 3; i >= 0; i--) { @@ -321,6 +326,9 @@ - (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout encoding:NSUTF8StringEncoding]]; } const CGFloat cornerRadius = [[UIScreen.mainScreen valueForKey:selectorName] floatValue]; +#else + const CGFloat cornerRadius = 64.0f; +#endif frame.size.width = CGRectGetWidth(self.view.bounds) - MAX(cornerRadius, insets.bottom * 2.0f); } else { frame.size.width = CGRectGetWidth(self.view.bounds); diff --git a/Objective-C/TOCropViewController/Views/TOCropToolbar.m b/Objective-C/TOCropViewController/Views/TOCropToolbar.m index 7668d226..e4215bce 100644 --- a/Objective-C/TOCropViewController/Views/TOCropToolbar.m +++ b/Objective-C/TOCropViewController/Views/TOCropToolbar.m @@ -58,10 +58,18 @@ - (void)setup { self.backgroundView = [[UIView alloc] initWithFrame:self.bounds]; UIView *containerView = self; +#ifdef __IPHONE_26_0 if (@available(iOS 26.0, *)) { + UIVisualEffect *effect = nil; +#if !TARGET_OS_VISION UIGlassEffect *glassEffect = [UIGlassEffect effectWithStyle:UIGlassEffectStyleClear]; glassEffect.interactive = YES; - _glassView = [[UIVisualEffectView alloc] initWithEffect:glassEffect]; + effect = glassEffect; +#else + UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleProminent]; + effect = blurEffect; +#endif + _glassView = [[UIVisualEffectView alloc] initWithEffect:effect]; _glassView.cornerConfiguration = [UICornerConfiguration capsuleConfiguration]; _glassView.userInteractionEnabled = YES; [self addSubview:_glassView]; @@ -72,6 +80,10 @@ - (void)setup { self.backgroundView.backgroundColor = [UIColor colorWithWhite:0.12f alpha:1.0f]; [self addSubview:self.backgroundView]; } +#else + self.backgroundView.backgroundColor = [UIColor colorWithWhite:0.12f alpha:1.0f]; + [self addSubview:self.backgroundView]; +#endif // On iOS 9 and up, we can use the new layout features to determine whether we're in an 'Arabic' style language mode _reverseContentLayout = ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft); @@ -103,11 +115,17 @@ - (void)setup { [_doneIconButton setImage:[TOCropToolbar doneImage] forState:UIControlStateNormal]; [_doneIconButton setTintColor:[UIColor colorWithRed:1.0f green:0.8f blue:0.0f alpha:1.0f]]; [_doneIconButton addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; +#if defined(__IPHONE_26_0) if (@available(iOS 26.0, *)) { +#if !TARGET_OS_VISION UIButtonConfiguration *configuration = [UIButtonConfiguration prominentGlassButtonConfiguration]; configuration.baseForegroundColor = [UIColor blackColor]; +#else + UIButtonConfiguration *configuration = [UIButtonConfiguration filledButtonConfiguration]; +#endif _doneIconButton.configuration = configuration; } +#endif [self addSubview:_doneIconButton]; // Set the default color for the done buttons @@ -132,9 +150,15 @@ - (void)setup { _cancelIconButton = [UIButton buttonWithType:UIButtonTypeSystem]; [_cancelIconButton setImage:[TOCropToolbar cancelImage] forState:UIControlStateNormal]; [_cancelIconButton addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; +#if defined(__IPHONE_26_0) if (@available(iOS 26.0, *)) { +#if !TARGET_OS_VISION _cancelIconButton.configuration = [UIButtonConfiguration clearGlassButtonConfiguration]; +#else + _cancelIconButton.configuration = [UIButtonConfiguration filledButtonConfiguration]; +#endif } +#endif [self addSubview:_cancelIconButton]; _clampButton = [UIButton buttonWithType:UIButtonTypeSystem];