What constraints should be given to increase size of imageview with respect to device screen size without reducing image clarity

前端 未结 3 1983
温柔的废话
温柔的废话 2020-12-20 06:31

I have to show an imageview in a universal app ans it\'s size should increase as the screen design in every devices without reducing image quality. The image given to the i

3条回答
  •  生来不讨喜
    2020-12-20 07:13

    To make Imageviewsize respect to device for universal application , you need to give correct multipler to imageview.

    please follow step to get desire output,


    Step 1 :- Set Aspect Ratio to your imageview . (you can also set leading and trialing top , bottom etc. and then give aspect ratio.)

    Aspect ration required to maintain to set image equal width and Height (Square)


    Step 2 :- Set Horizontal center and vertically center imageview . (it will be differ according to your requirement , you can also take this step as step 1 and then set aspect ratio)


    Step 3 :- Set Equal height to Superview from imageview.

    (Don't panic , you will get warning to update frames or constrain but don't update it)


    Step 4 :- Count Accurate Multiplier.

    imageviewHeight / superview's height = Accurate Multipliar
    

    Here ,

    imageviewheight = 200 , superviewheight=600   so ,
    
    200(imageviewheight)/600(superviewheight)=0.333 
    

    (set multipler to imageview where proposanal height = superview)


    Step 5 :- check output to different simulator.

    I hope this detail explanation is enought to understand your question.

提交回复
热议问题