iPhone 6和iPhone 6 Plus上的UIImageView高度缩放显示模式 [英] UIImageView height on iPhone 6 and iPhone 6 Plus Zoomed display mode

查看:115
本文介绍了iPhone 6和iPhone 6 Plus上的UIImageView高度缩放显示模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ViewController中有一个UIImageView *backgroundImageView,并在我的viewDidLoad中调用了

I have a UIImageView *backgroundImageView in my ViewController and call in my viewDidLoad

[self.backgroundImageView sizeToFit]

我发现在 iPhone 6 上,高度从667 (Normal display)更改为558 (Zoomed display)

I found that on the iPhone 6 the height changes from 667 (Normal display) to 558 (Zoomed display)

但是在 iPhone 6 Plus 上,两者的高度均保持在736.

However on the iPhone 6 Plus the height remains the same at 736 for both.

这是预期的吗?

推荐答案

尝试一下.这里给出了基于您当前屏幕高度的代码.

Try it. Here Given code based on your current screen height.

float img = frame.size.height / frame.size.width;

frame.size.width = [[UIScreen mainScreen] bounds].size.width;

frame.size.height = frame.size.width * img ;

这篇关于iPhone 6和iPhone 6 Plus上的UIImageView高度缩放显示模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆