I have a UIBarButtonItem
that has a UITextField
as its customView. The toolbar contains this item and a few buttons.
As the toolbar resizes (say on a device-orientation change) I want the UITextField
to grow or shrink (width) to occupy all the available space in the toolbar.
Short of figuring out the combined sizes of all the buttons in the toolbar, then setting the UITextField
width appropriately, is there just some magical way to make this item behave like a flexible-space bar item?
If you set UIViewAutoresizingFlexibleWidth
to your textfield it should automatically shrink or grow.