在UIToolbar之间添加间距 [英] Add spacing between UIToolbar

查看:340
本文介绍了在UIToolbar之间添加间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的工具栏:

I have a toolbar that looks like the following:

问题是它有点混乱,因此我想为它添加一些间距。我尝试过:

The issue is that it is kind of cluttered and therefore I would like to add some spacing to it. I tried doing:

UIBarButtonItem *spacer = 
 [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
                                               target:nil 
                                               action:nil];

self.toolbar_array = 
 [[NSMutableArray alloc] initWithObjects:self.mention, 
                                         spacer, 
                                         self.picture, 
                                         spacer, 
                                         share, 
                                         spacer, 
                                         self.message, nil];

但它仍然给了我同样的东西。如何在这些 UIBarButtonItems 之间添加10px?

But it still gives me the same thing. How can I add a 10px between these UIBarButtonItems?

推荐答案

UIBarButtonItem *fixedSpace = 
  [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace 
                                                target:nil 
                                                action:nil];
fixedSpace.width = 10;

这篇关于在UIToolbar之间添加间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆