Search Unity

How to scale UIImage and ScrollView

Discussion in 'UGUI & TextMesh Pro' started by GKuta95, Mar 15, 2018.

  1. GKuta95

    GKuta95

    Joined:
    Mar 6, 2017
    Posts:
    3
    Hi,
    I'm developing android app. On one of the screens I need to load png with math formulas. The image which I must load depends on the user's choice. Some of the png's have big height and some of them not, so I added ScrollView and then i put UIImage into it . There I have a problem. I don't know how to scale content size to fit my png size. When I make a big content in scrollView and then put sprite into UIImage it isn't look good when I load png with small height (big white space on top of the sprite). How can I scale UIImage and ScrollView content to fit png size? I tried to add content size fitter but it didn't work well.

    Thank you for your help!
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Try adding a vertical layout group with the check boxes off, and a content size fitter with preferred for horizontal and vertical. I just did a quick test and that seems to be working.