在我的应用中,用户可以拍摄横向或纵向照片。拍照后,使用以下代码将其传输到另一个 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中,如何将图像显示为肖像
如果它被视为肖像,我如何将图像显示为风景
如果它被视为风景
答案 0 :(得分:0)
您可以查看宽高比。
if image.size.height > image.size.width {
potraitImageView.image = image
}
else {
landscapeImageView.image = image
}