[英]Autolayout not working only in iPhone 7 plus
autolayout is not working only in iPhone 7 plus 自动布局仅在iPhone 7 plus中不起作用
it can't be center both horizontal and vertical 水平和垂直都不能居中
it looks like this 看起来像这样
there is some space, it's not fit! 有一些空间,不合适! but, it work well in other iphone device
但是,它可以在其他iPhone设备上正常工作
here is iphone 7 ( there is no empty space compare to iphone 7 plus ) 这是iphone 7(与iphone 7 plus相比没有可用空间)
I can see that image alignment is x,y center in indicator 我可以看到图像对齐在指示器中心是x,y
here is constraint 这是约束
image size is 图片大小为
@1x:320x100 / @2x:640x200 / @3x:960x300 @ 1x:320x100 / @ 2x:640x200 / @ 3x:960x300
I think image size is correct... 我认为图片大小是正确的...
What is your imageView.contentMode
? 你的
imageView.contentMode
是什么? It seems like it is not scaling up the image. 似乎没有按比例放大图像。 An iPhone 7s width is
414pt
. iPhone 7s的宽度为
414pt
。 414pt - 28pt * 2 = 358pt
. 414pt - 28pt * 2 = 358pt
。 Your image would have to be at least 358pt
wide to not have any padding and not require upscaling. 您的图片必须至少为
358pt
宽才能没有填充,也不需要放大。 That would be 1074x336
for the @3x dimensions. @ 3x尺寸将为
1074x336
。
Alternatively, just set the contentMode to .scaleAspectFill
. 或者,只需将contentMode设置为
.scaleAspectFill
。 Rather than having the rounded corners in the image itself, you could set the imageView to have rounded corners, to make scaling easier. 您可以将imageView设置为具有圆角,而不是在图像本身中具有圆角,以使缩放更容易。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.