TimOliver / TOCropViewController

A view controller for iOS that allows users to crop portions of UIImage objects
http://www.timoliver.com.au/2015/06/21/tocropviewcontroller-an-open-source-image-cropper-for-ios/
MIT License
4.73k stars 954 forks source link

make `reverseContentLayout` externally modifiable #568

Closed toya108 closed 7 months ago

toya108 commented 8 months ago

Why

The reverseContentLayout is currently determined by the TOCropToolBar's semanticContentAttributes and is used when determining whether the view should be reversed left or right.

https://github.com/TimOliver/TOCropViewController/blob/a942414508012b13102f776eb65dac655f31cabb/Objective-C/TOCropViewController/Views/TOCropToolbar.m#L64

However, this is determined at setup time and cannot be changed later. This makes it difficult to determine the layout direction externally.

How

Expose reverseContentLayout and allow it to be changed externally. In addition, call setNeedsLayout in the setter to change the layout according to the changed value.

ScreenShot

CropViewControllerExample

reverseContentLayout is false reverseContentLayout is true

TOCropViewControllerExample

reverseContentLayout is false reverseContentLayout is true
TimOliver commented 7 months ago

This PR is fantastic! Thanks so much @toya108!