Skip to content

Commit 2001288

Browse files
committed
Fix up alignment of glass
1 parent ef5e8b7 commit 2001288

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Objective-C/TOCropViewController/Views/TOCropToolbar.m

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,10 @@ - (void)setup {
6767
[self addSubview:_glassView];
6868

6969
containerView = _glassView.contentView;
70+
_showOnlyIcons = YES;
7071
} else {
7172
self.backgroundView.backgroundColor = [UIColor colorWithWhite:0.12f alpha:1.0f];
72-
}
73-
[self addSubview:self.backgroundView];
74-
75-
if (@available(iOS 26.0, *)) {
76-
_showOnlyIcons = YES;
73+
[self addSubview:self.backgroundView];
7774
}
7875

7976
// On iOS 9 and up, we can use the new layout features to determine whether we're in an 'Arabic' style language mode
@@ -322,8 +319,9 @@ - (void)layoutToolbarButtons:(NSArray<UIButton *> *)buttons withSameButtonSize:(
322319
const CGFloat buttonSize = 44.0f;
323320

324321
if (@available(iOS 26.0, *)) {
322+
CGFloat glassPadding = 4.0f;
325323
CGFloat minPadding = 8.0f;
326-
CGFloat maxExtent = buttons.count * buttonSize + (minPadding * (buttons.count - 1));
324+
CGFloat maxExtent = buttons.count * buttonSize + (minPadding * (buttons.count - 1)) + (glassPadding * 2.0f);
327325

328326
CGRect glassFrame = CGRectZero;
329327
glassFrame.size.width = horizontally ? MIN(containerRect.size.width - (minPadding * 2.0f), maxExtent) : buttonSize;
@@ -332,7 +330,7 @@ - (void)layoutToolbarButtons:(NSArray<UIButton *> *)buttons withSameButtonSize:(
332330
glassFrame.origin.y = horizontally ? 0.0f : CGRectGetMidY(containerRect) - (glassFrame.size.height / 2.0f);
333331
_glassView.frame = glassFrame;
334332

335-
CGFloat position = 0.0f;
333+
CGFloat position = glassPadding;
336334
for (UIButton *button in buttons) {
337335
CGRect buttonFrame = CGRectMake(0.0, 0.0, buttonSize, buttonSize);
338336
if (horizontally) {

0 commit comments

Comments
 (0)