欢迎光临
我们一直在努力

YSHYClipImageDemo

建站超值云服务器,限时71元/月

YSHYClipImageDemo

项目介绍:

YSHYClipImageDemo

图片裁剪

基于imagePickerController 实现圆形 方形两种方式的图片裁剪,支持自定义裁剪大小,支持自定义图片缩放比例

pragma mark – imagePickerControllerDelegate

-(void)imagePickerController:(UIImagePickerController )picker didFinishPickingMediaWithInfo:(NSDictionary<NSString ,id> *)info
{

UIImage * image = info[@"UIImagePickerControllerOriginalImage"];

YSHYClipViewController * clipView = [[YSHYClipViewController alloc]initWithImage:image];
clipView.delegate = self;
clipView.clipType = clipType; //支持圆形:CIRCULARCLIP 方形裁剪:SQUARECLIP   默认:圆形裁剪
if(![textField.text isEqualToString:@""])
{
    radius =textField.text.intValue;
    clipView.radius = radius;   //设置 裁剪框的半径  默认120
}
//    clipView.scaleRation = 5;// 图片缩放的最大倍数 默认为10
[picker pushViewController:clipView animated:YES];

}

pragma mark – ClipViewControllerDelegate

-(void)ClipViewController:(YSHYClipViewController )clipViewController FinishClipImage:(UIImage )editImage
{

  [clipViewController dismissViewControllerAnimated:YES completion:^{
      [btn setImage:editImage forState:UIControlStateNormal];
  }];;

}

image

code4app

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » YSHYClipImageDemo
分享到: 更多 (0)