Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Objective-C/TOCropViewController/TOCropViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -314,13 +318,17 @@ - (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--) {
selectorName = [selectorName stringByAppendingString:[NSString stringWithCString:components[i]
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);
Expand Down
26 changes: 25 additions & 1 deletion Objective-C/TOCropViewController/Views/TOCropToolbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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];
Expand Down