imageview设置在最顶层,如何在imageView上设置自动布局约束以获得高分辨率图像?...

I am new in auto layouts and assets of images. I am confused that image view height and width I have to set fix or according to superview, will it effect on resolution or not.

I have a image view 40x40. And I have assets of images are 1x = 72x72, 2x = 96x96, 3x = 144x144. I have to set image for all devices with good resolution, and I want width and height according to Superview. What constraint do I have to use and how can I get good resolution for all devices?

Is Adaptive Layout necessary to use? I mean Autolayouts for Assets?

解决方案

Give only these constraints for UIViewImage:

vertically centre to superView(Multiplier if needed)

horizontally centre to superView(Multiplier if needed)

height wrt superView.height(Multiplier for the constraint)

aspect ratio to itself

761fa9e2170c7bded6fb77b7877db3e0.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值