iOS Autolayout and UIToolbar/UIBarButtonItems
问题 I have an iOS view with autolayout enabled and have a UIToolbar with a UISearchBar and UISegmentControl contained with the toolbar. I want the UISearchBar to have a flexible width so I need to add a constraint to force this, but from what I can tell you cannot add constraints to items in a UIToolbar in Interface Builder. The options are all disabled. Before AutoLayout I would accomplish this with autoresizingmasks . Are constraints not allowed within UIToolbars/UINavigationBars ? How else can