gpt4 book ai didi

ios - 如何在GL中显示图像根据拍摄位置查看横向或纵向

转载 作者:行者123 更新时间:2023-11-30 13:50:30 24 4
gpt4 key购买 nike

在我的应用程序中,用户可以横向或纵向拍照。拍照后,将其传输到另一个UIViewController,代码如下:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let sp = storyboard.instantiateViewControllerWithIdentifier("sendPhoto") as! sendPhotoScreen
sp.photoImage = newImage
self.presentViewController(sp, animated: true, completion: nil)

在sendPhotoScreen中,如何将图像显示为纵向

portrait

如果是纵向拍摄,如何将图像显示为横向

landscape

如果是风景

最佳答案

您可以检查宽高比。

if image.size.height > image.size.width {
potraitImageView.image = image
}
else {
landscapeImageView.image = image
}

关于ios - 如何在GL中显示图像根据拍摄位置查看横向或纵向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34350718/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com