首页 文章

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

提问于
浏览
0

在我的应用程序中,用户可以拍摄横向或纵向照片 . 拍照后,使用以下代码将其传输到另一个 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

如果它被视为景观

1 回答

  • 0

    你可以检查宽高比 .

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

相关问题