我有一个应用程序,我需要将图像裁剪到特定的frame.ie CGRectMake(20,40,280,200)。然后我拍摄我的图像并在
pickerdidfinish
我这样做就像`
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.为什么它如此。我需要有一个叠加视图,这使得摄像机视图的一部分仅对用户有效。因此,用户可以选择他想要的任何部分。这只是为了显示。但我不知道我哪里出错了。有人帮我吗?