Я разрабатываю приложение для обрезки изображений. Я использую следующий код для вызова метода кадрирования:Обрезка изображения Позвольте картине вращаться влево
UIImage* croppedImage = [self imageCrop:imageView toRect:CGRectMake(10.0, 50.0, 320, 100)];
и вот код метода:
{
//create a context to do our clipping in
CGRect newRect = CGRectApplyAffineTransform(rect, imageViewToCrop.transform);
UIImage *imageToCrop = imageViewToCrop.image;
UIGraphicsBeginImageContext(newRect.size);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
//create a rect with the size we want to crop the image to
//the X and Y here are zero so we start at the beginning of our
//newly created context
CGRect clippedRect = CGRectMake(0, 0, rect.size.width, rect.size.height);
CGContextClipToRect(currentContext, clippedRect);
//draw the image to our clipped context using our offset rect
CGContextDrawImage(currentContext, newRect, imageToCrop.CGImage);
//pull the image from our cropped context
UIImage *cropped = UIGraphicsGetImageFromCurrentImageContext();
//pop the context to get back to the default
UIGraphicsEndImageContext();
return cropped;
}
Проблема заключается в том, когда я установил этот образ UIImageView, я что возвращенное изображение повернуто влево. И я не могу получить его «Вращение вверх». Любой может знать проблему?
Привет, когда я делаю это, мое вращение все еще выключено. Можете ли вы придумать причину, по которой использование imageOrientation не работает должным образом? – Aggressor