【iOS】图片裁剪

####【iOS】图片裁剪

UIImage *imageTop=[UIImage imageNamed:@"1111.jpg"];

//根据创建的image 进行区域裁剪(关键代码)

CGImageRef refTopImg = CGImageCreateWithImageInRect(imageTop.CGImage, CGRectMake(0, 0, imageTop.size.width, imageTop.size.height/2));

_topImageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 375, 667/2)];

_topImageView.image =[UIImage imageWithCGImage:refTopImg];

[self.view addSubview:_topImageView];

[Demo地址](https://github.com/joealzhou/cutImage)

你可能感兴趣的:(【iOS】图片裁剪)