Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 调整uiimage的大小就是翻转它?_Objective C - Fatal编程技术网

Objective c 调整uiimage的大小就是翻转它?

Objective c 调整uiimage的大小就是翻转它?,objective-c,Objective C,我正在尝试调整UIImage的大小。我正在拍摄图像,并将其宽度设置为640(例如),检查我必须使用的系数,并将其用于图像高度 不知何故,图像有时会翻转,即使是肖像图像,也会变成风景。 我可能没有注意这里的一些事情 //scale 'newImage' CGRect screenRect = CGRectMake(0, 0, 640.0, newImage.size.height* (640/newImage.size.width) ); UIGraphicsBeginImag

我正在尝试调整UIImage的大小。我正在拍摄图像,并将其宽度设置为640(例如),检查我必须使用的系数,并将其用于图像高度

不知何故,图像有时会翻转,即使是肖像图像,也会变成风景。 我可能没有注意这里的一些事情

  //scale 'newImage'
    CGRect screenRect = CGRectMake(0, 0, 640.0, newImage.size.height* (640/newImage.size.width) );
    UIGraphicsBeginImageContext(screenRect.size);
    [newImage drawInRect:screenRect];
    UIImage *scaled = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

好的,我有答案,但不是她。 当我从assetLibrary中拍摄图像时,我随身携带了:

CGImageRef imageRef = result.defaultRepresentation.fullResolution;
这将翻转图像,现在我使用:

CGImageRef imageRef = result.defaultRepresentation.fullScreenImage;

图像很好。

注意图像。方向,可能需要转置。