-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add showAttachedCropToolbar option to CropToolbarConfig (#177)
* feat: add showNativeCropToolbar option to CropToolbarConfig change CocoaPods deployment target 13.0 update an example to show showNativeCropToolbar's support remove some unnecessary self * feat: support 11.0 again rename showBottomCropToolbar to showAttachedCropToolbar * refactor: make CropToolbar buttons lazy vars add getCancelIcon and getCropIcon to CropToolbarIconProvider protocol
- Loading branch information
1 parent
eaa8f06
commit 417f607
Showing
13 changed files
with
461 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// MyNavigationCropToolbar.swift | ||
// MantisExample | ||
// | ||
// Created by Echo on 7/10/22. | ||
// Copyright © 2022 Echo. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Mantis | ||
import UIKit | ||
|
||
class MyNavigationCropToolbar: UIView, CropToolbarProtocol { | ||
var config: CropToolbarConfigProtocol? | ||
|
||
var heightForVerticalOrientation: CGFloat? | ||
|
||
var widthForHorizonOrientation: CGFloat? | ||
|
||
var cropToolbarDelegate: CropToolbarDelegate? | ||
|
||
var iconProvider: CropToolbarIconProvider? | ||
|
||
weak var cropViewController: Mantis.CropViewController? | ||
|
||
func createToolbarUI(config: CropToolbarConfigProtocol?) { | ||
guard let cropViewController = cropViewController else { | ||
return | ||
} | ||
|
||
cropViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .close, target: self, action: #selector(cancel)) | ||
|
||
let rotateButton = UIBarButtonItem(image: UIImage(systemName: "rotate.right"), style: .plain, target: self, action: #selector(rotate)) | ||
let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(crop)) | ||
|
||
cropViewController.navigationItem.rightBarButtonItems = [doneButton, rotateButton] | ||
} | ||
|
||
func handleFixedRatioSetted(ratio: Double) { | ||
|
||
} | ||
|
||
func handleFixedRatioUnSetted() { | ||
|
||
} | ||
|
||
@objc func crop() { | ||
cropToolbarDelegate?.didSelectCrop() | ||
} | ||
|
||
@objc func cancel() { | ||
cropToolbarDelegate?.didSelectCancel() | ||
} | ||
|
||
@objc func rotate() { | ||
cropToolbarDelegate?.didSelectClockwiseRotate() | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
</p> | ||
|
||
## Requirements | ||
* iOS 13.0+ | ||
* iOS 11.0+ | ||
* MacOS 10.15+ | ||
* Xcode 10.0+ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.