我有以下代码:
UIGraphicsBeginImageContext(CGSizeMake(self.captureImageView.frame.size.width, self.captureImageView.frame.size.height));
[image drawInRect: CGRectMake(0, 0, self.captureImageView.frame.size.width, self.captureImageView.frame.size.height)];
UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGRect cropRect = CGRectMake(0, 0, self.captureImageView.frame.size.width, self.captureImageView.frame.size.height);
CGImageRef imageRef = CGImageCreateWithImageInRect([smallImage CGImage], cropRect);
[self.captureImageView setImage:[UIImage imageWithCGImage:imageRef]];
CGImageRelease(imageRef);
//rotation
[UIView beginAnimations:@"rotate" context:nil];
[UIView setAnimationDuration:0.5];
int degrees = [self rotationDegrees];
CGFloat radians =degrees * M_PI / 180.0;
self.captureImageView.transform = CGAffineTransformMakeRotation(radians);
[UIView commitAnimations];
当以横向模式拍摄图像时,无论是向左还是向右,uiimageview 中呈现的图像都不会填满整个 frame.size 并且总是“短”
有人可以在我的代码中修复/添加什么吗?