UIToolbar 上的按钮间距

发布于 2024-12-15 16:27:56 字数 324 浏览 2 评论 0原文

我的 UIToolbar 上的按钮间距有问题,请查看此图像:

这是我当前的输出,它是 UIBarButtonItem 上的 UIButton,这不是我想要做的所需间距,我只是将其设置在其上nib 文件,它们无法彼此靠近。

这是我想要的输出。

在此处输入图像描述

你知道如何设置间距吗?通过代码还是通过它的 nib 文件?

提前致谢!

I am having a problem with the spacing of my button on my UIToolbar look at this images:

Here is my current out put it's a UIButton on a UIBarButtonItem and it's not the desired spacing that i am trying to do, i just set it on its nib file and they can't get any closer to each other.

and here is the output that i want.

enter image description here

Do you how can i set the spacing? by code or by its nib file?

thanks in advance!

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

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

发布评论

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

评论(2

油饼 2024-12-22 16:27:56

如果您使用 .xib 文件,那么您可以使用“灵活空格键按钮项或固定空格键按钮项”,

通过在工具栏项之间使用这些项,您可以分配它们之间的空间。
它非常方便并且效果很好在此处输入图像描述

If you are using .xib file then you can use "Flexible space bar button Item or fixed space bar button item"

by using these between your toolbar items you can assign the space between them..
Its pretty handy and works goodenter image description here

瘫痪情歌 2024-12-22 16:27:56
NSMutableArray *baritem =[NSMutableArray array];
[baritem addObject:return_button];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];
[baritem addObject:preview];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];
[baritem addObject:play_button];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];
[baritem addObject:next];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];


#define SYSBARBUTTON(ITEM, SELECTOR) [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:ITEM target:self action:SELECTOR] autorelease]

通过这个我正在设置空间

NSMutableArray *baritem =[NSMutableArray array];
[baritem addObject:return_button];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];
[baritem addObject:preview];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];
[baritem addObject:play_button];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];
[baritem addObject:next];
[baritem addObject:SYSBARBUTTON(UIBarButtonSystemItemFlexibleSpace, nil)];


#define SYSBARBUTTON(ITEM, SELECTOR) [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:ITEM target:self action:SELECTOR] autorelease]

by this i am setting space

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