omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Aspect ratio of an image view?

    Editorial
    1
    2
    1897
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • metawops
      metawops last edited by

      Hi,

      in the UI editor of a Python script action I created a ScrollView and inside that ScrollView I embedded an ImageView.
      At design time I have to set the dimensions of that image view. Currently it's the default square (200x200).

      Via the Image URL property I loaded a non-square image that's displayed distorted now because the view want to make both, the width & the height to fit.

      Is there a way to tell the IamgeView not to squeeze my non-square image into the square view?
      I want to add several more ImageViews later and they all should be square but the actual images won't be square most of the time.

      Thanks,
      Stefan.

      1 Reply Last reply Reply Quote 0
      • metawops
        metawops last edited by

        Oh! I found something!
        Looks like I have to set the property content_mode of the ImageView.
        Like this:

        view.subviews[0].subviews[0].content_mode = ui.CONTENT_SCALE_ASPECT_FIT
        

        I can't find this property in the UI editor. So I have to set it at run time?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors