SeongHo
SeongHo

Reputation: 1040

Button spacing on UIToolbar

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!

Upvotes: 0

Views: 2306

Answers (2)

Ajeet Pratap Maurya
Ajeet Pratap Maurya

Reputation: 4254

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

Upvotes: 2

user972462
user972462

Reputation:

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

Upvotes: 2

Related Questions