I am trying to set the auto-resizing on a subclass of a navigation bar, and a segmented control. I need to do this in code, and not interface builder.
I want the code equivalent of this interface setup.

Edit:
I have tried this, but it does not work.
[self.segmentedControl setAutoresizingMask: UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin];
The View Programming Guide notes:
You want the bottom, left, and right margins to be fixed (which is the default), and the top margin to be flexible. Try this: