且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS的自动布局和UIToolbar / UIBarButtonItems

更新时间:2023-01-04 08:10:27

自动布局的限制只能用 UIViews 及其子类的工作。

Autolayout constraints only work with UIViews and their subclasses.

UIToolbar 允许一些的UIView 根据项目(如的UISearchBar UISegmentedControl ),它们可能与共存 UIBarButtonItems 不从 UIView的

While UIToolbar allows some UIView based items (such as UISearchBar and UISegmentedControl) they may have to coexist with UIBarButtonItems which do not inherit from UIView.

直到自动布局可以用 UIBarButtonItems 工作,做你做的事。

Until autolayout can work with UIBarButtonItems, do as you have done.

您的选择是与仅基于 UIViews 部件推出自己的工具栏。

Your alternative is to roll your own toolbar with widgets based only on UIViews.