Skip to content

Commit 4fe9b48

Browse files
committed
Added visible cancel button property to toolbar
1 parent 8dd9bd5 commit 4fe9b48

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

Objective-C/TOCropViewController/Views/TOCropToolbar.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,25 @@ NS_ASSUME_NONNULL_BEGIN
3535

3636
/* The 'Done' buttons to commit the crop. The text button is displayed
3737
in portrait mode and the icon one, in landscape. */
38-
@property (nonnull, nonatomic, strong, readonly) UIButton *doneTextButton;
39-
@property (nonnull, nonatomic, strong, readonly) UIButton *doneIconButton;
40-
@property (nonnull, nonatomic, copy) NSString *doneTextButtonTitle;
38+
@property (nonatomic, strong, readonly) UIButton *doneTextButton;
39+
@property (nonatomic, strong, readonly) UIButton *doneIconButton;
40+
@property (nonatomic, copy) NSString *doneTextButtonTitle;
4141

4242

4343
/* The 'Cancel' buttons to cancel the crop. The text button is displayed
4444
in portrait mode and the icon one, in landscape. */
45-
@property (nonnull, nonatomic, strong, readonly) UIButton *cancelTextButton;
46-
@property (nonnull, nonatomic, strong, readonly) UIButton *cancelIconButton;
47-
@property (nonnull, nonatomic, copy) NSString *cancelTextButtonTitle;
45+
@property (nonatomic, strong, readonly) UIButton *cancelTextButton;
46+
@property (nonatomic, strong, readonly) UIButton *cancelIconButton;
47+
@property (nonatomic, readonly) UIView *visibleCancelButton;
48+
@property (nonatomic, copy) NSString *cancelTextButtonTitle;
4849

4950
/* The cropper control buttons */
50-
@property (nonnull, nonatomic, strong, readonly) UIButton *rotateCounterclockwiseButton;
51-
@property (nonnull, nonatomic, strong, readonly) UIButton *resetButton;
52-
@property (nonnull, nonatomic, strong, readonly) UIButton *clampButton;
51+
@property (nonatomic, strong, readonly) UIButton *rotateCounterclockwiseButton;
52+
@property (nonatomic, strong, readonly) UIButton *resetButton;
53+
@property (nonatomic, strong, readonly) UIButton *clampButton;
5354
@property (nullable, nonatomic, strong, readonly) UIButton *rotateClockwiseButton;
5455

55-
@property (nonnull, nonatomic, readonly) UIButton *rotateButton; // Points to `rotateCounterClockwiseButton`
56+
@property (nonatomic, readonly) UIButton *rotateButton; // Points to `rotateCounterClockwiseButton`
5657

5758
/* Button feedback handler blocks */
5859
@property (nullable, nonatomic, copy) void (^cancelButtonTapped)(void);

Objective-C/TOCropViewController/Views/TOCropToolbar.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,4 +613,13 @@ - (void)setStatusBarHeightInset:(CGFloat)statusBarHeightInset
613613
[self setNeedsLayout];
614614
}
615615

616+
- (UIView *)visibleCancelButton
617+
{
618+
if (self.cancelIconButton.hidden == NO) {
619+
return self.cancelIconButton;
620+
}
621+
622+
return self.cancelTextButton;
623+
}
624+
616625
@end

0 commit comments

Comments
 (0)