Place the button element on the toolbar

I have a toolbar at the top and bottom of my application, and I need to create buttons for placement in the toolbars. Those who are developing this application would like to place the space between the buttons on the toolbar. Besides manual coding in changing the position for buttons, is there a better way to do this through Interface Builder?

+5
source share
2 answers

You can add a panel button of type UIBarButtonSystemItemFlexibaleSpace in the place where you want a space.

UIBarButtonItem *barButton1 = ...
UIBarButtonItem *barButton2 = ...

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

toolbar.items = [NSArray arrayWithObjects:barButton1, 
                                          flexibleSpaceBarButton, 
                                          barButton2, nil];
+23
source

EmptyStack, UIBarButtonItemFlexibleSpace . , , Interface Builder. IB , , . , , , "" . , UIButtons.

+2

All Articles