Search code examples
cocoaviewscale

Cocoa View auto-scale content


I am trying to build an cocoa app using Xcode 4.2 and i did not manage to find how to make the content of a view to auto-scale on resize. I have an Image view inside the View and I want it to rescale the image view when i resize the app so it will always be on the entire window. Can anyone tell me how to do that without making it by myself when the resize event is triggered ? Thanks in advance,

Stefan


Solution

  • If you're using manual layout, use something like this:

    enter image description here

    If you're using auto layout, align the image well's edges to the edges of the window, and set the content hugging priorities below the priority of the window resize.

    enter image description here