我有一个应用程序,我需要将图像裁剪到特定的帧。即 CGRectMake(20,40, 280,200)。然后我正在拍摄我的图像并在
选择器完成
我正在这样做`
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
//code for crop
CGRect rect=CGRectMake(20,40,280,180);
CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], rect);
UIImage *newImg = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
CGSize size = [newImg size];
UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, size.width, size.height)];
NSLog(@"frame = %@\n", NSStringFromCGRect(btn.frame));
imageData =[[Utility getCompressedData:newImg]retain];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
[self dismissModalViewControllerAnimated:YES];
`并上传图像。但是当我从上传的服务器获取图像时,它仍然是 360*480。为什么会这样。我需要有一个覆盖视图,它只对用户启用部分相机视图。所以用户可以参加他想要的任何部分。那只是显示。但我不知道我哪里出错了。有人可以帮助我吗?