Closed thuongvanbui39 closed 3 years ago
You can do this by override toolbar, but the height of this toolbar is immutable.
toolbar
class CustomCropperViewController: CropperViewController { override var toolbar: UIView { get { return customToolbar } set { customToolbar = newValue } } lazy var customToolbar: UIView = { let v = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.safeAreaInsets.bottom + 44)) v.backgroundColor = .red let button = UIButton(frame: CGRect(x: 100, y: 0, width: 200, height: 44)) button.addTarget(self, action: #selector(button1Pressed(_:)), for: .touchUpInside) button.setTitle("ButtonTitle", for: .normal) button.setTitleColor(.white, for: .normal) button.titleLabel?.font = .systemFont(ofSize: 20) v.addSubview(button) return v }() @objc func button1Pressed(_ sender: UIButton) { self.rotate90degrees() } override func viewDidLoad() { super.viewDidLoad() isCropBoxPanEnabled = false topBar.isHidden = true angleRuler.isHidden = true aspectRatioPicker.isHidden = true } override func resetToDefaultLayout() { super.resetToDefaultLayout() aspectRatioLocked = true setAspectRatioValue(1.2) } }
If you need more custom UI, you need to directly modify the code of CropperViewController
Thank uuuuu <3
I don't find the properties to set aspect ratio like the above image in our lib. Could you help me?
You can do this by override
toolbar
, but the height of this toolbar is immutable.If you need more custom UI, you need to directly modify the code of CropperViewController