如何在 UIToolbar 上拥有多行项目?

发布于 2024-08-23 17:01:49 字数 405 浏览 6 评论 0原文

我正在尝试选择“方向”时在 Apple 的“地图”应用程序中执行的操作:

Hosted by imgur.com

有谁知道如何拥有多行 UIBarButtonItems?我在任何地方都没有找到答案。我可以将单行中的项目添加到 UIToolbar,如下所示:

    NSArray *newItems = [NSArray arrayWithObjects: settingsButton, textFieldStartItem, goButton, nil];
    toolBar.items = newItems;   

但这只是将所有项目放在同一行中。

有什么想法吗?

I'm trying for what is done in Apple's "Maps" app when "Directions" is selected:

Hosted by imgur.com

Does anyone know how to have multiple rows of UIBarButtonItems? I haven't found the answer anywhere. I can add items in a single row to the UIToolbar as follows:

    NSArray *newItems = [NSArray arrayWithObjects: settingsButton, textFieldStartItem, goButton, nil];
    toolBar.items = newItems;   

But that just puts all of the items in the same row.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情绪少女 2024-08-30 17:01:49

这不是标准工具栏,而是自定义视图。您无法使用基本 UI 类来完成此操作,您必须编写自己的类。一个简单的尝试是创建一个大型工具栏并在其顶部添加字段作为标准子视图。

This is not a standard toolbar, but a custom view. You can't do this using the basic UI classes, you'll have to write your own. A simple thing to try is to create a large toolbar and add fields as standard subviews on top of it.

旧人 2024-08-30 17:01:49

您必须使用自定义视图创建一个UIBarButtonItem

- (id)initWithCustomView:(UIView *)customView

You would have to create a UIBarButtonItem with a custom view.

- (id)initWithCustomView:(UIView *)customView
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文