A nice controller to crop round or rect images

3997
    


来源:
Licence:
联系:
分类:
平台:
环境:
大小:
更新:
标签:
联系方式 :
免费下载 ×

下载APP,支持永久资源免费下载

限免产品服务请联系qq:1585269081

下载APP
免费下载 ×

下载APP,支持永久资源免费下载

下载APP 免费下载
下载 ×

下载APP,资源永久免费


如果出现不能下载的情况,请联系站长,联系方式在下方。

免费下载 ×

下载论文助手APP,资源永久免费

免费获取

如果你已经登录仍然出现不能下载的情况,请【点击刷新】本页面或者联系站长



LECropPictureViewController What is this Want a nice crop editor for your picture? Not satisfied with the one provided for Apple? Likes rounded images? LECropPictureViewController is the component for you :)! See the how works in the gif below: Install Manually Drag and copy all files in the LECropPictureViewController folder into your project, or add it as a git submodule. CocoaPods LECropPictureViewController is available through CocoaPods . To install it, simply add the following line to your Podfile: pod " LECropPictureViewController " , " ~> 0.1 " How to use LECropPictureViewController works with any image. You just have to provide the image and a cropType when creating a new instance, and then present the view controller. The possible cropTypes are: LECropPictureTypeRounded LECropPictureTypeRect # import " LECropPictureViewController.h " LECropPictureViewController *cropPictureController = [[LECropPictureViewController alloc ] initWithImage: image andCropPictureType: LECropPictureTypeRounded]; [ self presentViewController: cropPictureController animated: YES completion: nil ]; The callback for the cropped picture is given through a block. See the exemple below, presenting the LECropPictureViewController inside the delegate of a UIImagePickerController: -( void )imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:( NSDictionary *)info { UIImage *image = info[UIImagePickerControllerOriginalImage]; [ self dismissViewControllerAnimated: NO completion: nil ]; LECropPictureViewController *cropPictureController = [[LECropPictureViewController alloc ] initWithImage: image andCropPictureType: LECropPictureTypeRounded]; cropPictureController. imageView . contentMode = UIViewContentModeScaleAspectFit; cropPictureController. photoAcceptedBlock = ^(UIImage *croppedPicture){ self. imageView . image = croppedPicture; }; [ self presentViewController: cropPictureController animated: NO completion: nil ]; } Customizing The LECropPictureViewController has public properties for its components. With this, you can do things like changing the contentMode of the imageView, changing the text of the barButtonItems, etc. @property (weak, nonatomic) UIBarButtonItem *cancelButtonItem; @property (weak, nonatomic) UIBarButtonItem *acceptButtonItem; @property (weak, nonatomic) UIImageView *imageView; Besides the subviews, you can customize other things like the initial frame of the crop area, borderColor and borderWidth, like below: (...) LECropPictureViewController *cropPictureController = [[LECropPictureViewController alloc ] initWithImage: image andCropPictureType: LECropPictureTypeRounded]; cropPictureController.cropFrame = CGRectMake( 50 , 50 , 250 , 250 ); cropPictureController.borderColor = [UIColor grayColor ]; cropPictureController.borderWidth = 1.0 ; (...) You can even implement the @property(copy) void(^photoRejectedBlock)(); , if you want to override the default behaviour of the cancel button (which only dismiss the controller). Be aware that, if you do this, you will be responsible to dismiss the controller yourself. cropPictureController.photoRejectedBlock = ^{ NSLog ( @" Doing something here! " ); [ self dismissViewControllerAnimated: YES completion: nil ]; }; Collaborate Liked the project? Is there something missing or that could be better? Feel free to contribute :) Fork it Create your branch git checkout -b name-your-feature Commit it git commit -m the difference Push it git push origin name-your-feature Create a Pull Request Author Lucas Eduardo, lucasecf@gmail.com License LECropPictureViewController is available under the MIT license. See the LICENSE file for more info.


免费下载 ×

下载APP,支持永久资源免费下载

下载APP 免费下载
温馨提示
请用电脑打开本网页,即可以免费获取你想要的了。
扫描加我微信 ×

演示

×
登录 ×


下载 ×
论文助手网
论文助手,最开放的学术期刊平台
				暂无来源信息			 
回复
来来来,吐槽点啥吧

作者联系方式

×

向作者索要->