Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wubianxiaoxian/PureCamera-Demo
A custom camera that allows for free cropping of photos upon completion.
https://github.com/wubianxiaoxian/PureCamera-Demo
Last synced: 3 months ago
JSON representation
A custom camera that allows for free cropping of photos upon completion.
- Host: GitHub
- URL: https://github.com/wubianxiaoxian/PureCamera-Demo
- Owner: wubianxiaoxian
- License: mit
- Created: 2016-10-18T10:30:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-15T13:41:58.000Z (almost 2 years ago)
- Last Synced: 2024-11-10T07:03:27.354Z (3 months ago)
- Language: Objective-C
- Homepage:
- Size: 13.7 MB
- Stars: 326
- Watchers: 11
- Forks: 67
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PureCamera
=[](https://travis-ci.org/wubianxiaoxian/PureCamera)
[](http://cocoapods.org/pods/PureCamera)
[](http://cocoapods.org/pods/PureCamera)
[](http://cocoapods.org/pods/PureCamera)A custom camera that allows for free cropping of photos upon completion
----Requirements
----* Xcode 8 or higher
* iOS 8.0 or higher
* ARCVersion
----* 1.6.3
Usage
----* Installation with CocoaPods: pod 'PureCamera', import
```objc
#import
```* Or download the demo locally and add PureCamera to your project, import
```objc
#import "PureCamera.h"
```* Add the following to info.plist
```objc
Privacy - Camera Usage Description Use camera
```* Use the following method to call the camera
```objc
PureCamera *homec=[[PureCamera alloc]init];
__weak typeof(self)myself=self;
homec.fininshcapture=^(UIImage *ss){
if (ss) {
NSLog(@"Photo exists");
//Here you can get the cropped photo
myself.ViewImageview.image=ss;
}
} ;
[self presentViewController:homec animated:NO completion:^{}];}
```* Use the following method to call the image cropping page
```objc
First import #import "TOCropViewController.h"
Adhere to @interface ViewController()
Pass in an image and you can present the image cropping pageTOCropViewController *cropController = [[TOCropViewController alloc] initWithImage:self.cropImageview.image];
cropController.delegate = self;
[self presentViewController:cropController animated:YES completion:nil];- (void)cropViewController:(TOCropViewController *)cropViewController didCropToImage:(UIImage *)image withRect:(CGRect)cropRect angle:(NSInteger)angle
{
self.cropImageview.image=image;
self.navigationItem.rightBarButtonItem.enabled = YES;
//The following defines an animation effect, which is that when the image cropping page disappears, it will use the frame of the view you defined as the boundary after the disappearance.
CGRect viewFrame = [self.view convertRect:self.cropImageview.frame toView:self.navigationController.view];
[cropViewController dismissAnimatedFromParentViewController:self withCroppedImage:image toFrame:viewFrame completion:^{
}];
}
```
If you encounter any problems during use, please feel free to submit an issue.