IBDesignable View w/ Fixed Aspect Ratio

I'm trying to build a IBDesignable View with a fixed aspect ratio. The goal is to be able to just assign the custom class and then be able to move and resize the view in Interface Builder while maintaining a set aspect ratio. Note: This means WITHOUT adding an Aspect Ratio constraint on the view with Interface Builder. I want a widget that just works.


Any ideas?

Replies

Currently Interface Builder does not allow overriding the layout interactions of a view via IBDesignable (e.g. overriding the standard resizing behaviors in IB). You should, however, be able to add an aspect ratio constraint to your view in your code and IB's auto layout integration will pick this up and properly size the view whenever you choose the "Update Frames" command in the canvas.