UIImageView height on iPhone 6 and iPhone 6 Plus Z

2019-09-01 02:31发布

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

[self.backgroundImageView sizeToFit]

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

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

Is this expected?

1条回答
爷的心禁止访问
2楼-- · 2019-09-01 02:46

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 ;
查看更多
登录 后发表回答