在UIToolbar之间添加间距

adi*_*dit 19 iphone objective-c uibarbuttonitem ipad toolbaritems

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

在此输入图像描述

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

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];
Run Code Online (Sandbox Code Playgroud)

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

Joe*_*Joe 46

UIBarButtonItem *fixedSpace = 
  [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace 
                                                target:nil 
                                                action:nil];
fixedSpace.width = 10;
Run Code Online (Sandbox Code Playgroud)