我有以下代碼:圖像沒有填充整個的UIImageView寬度和高度
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呈現的圖像時是沒有填充整個幀.size並總是「短」
可以點一下在我的代碼中修復/添加什麼?
將其添加到代碼,它不工作:( –
@liva你是否設置它時,視圖控制器第一次加載?它應該只需要設置一次 – trojanfoe
是把它放在viewDidLoad –