Add space to toolbar in iPhone - iphone

I am new to iPhone,
I have added a toolbar in my .xib file and then added 5 BarbuttonItem to the toolbar,
see snapshot:
you can see bar buttons on toolbar, but there is no spaces between them.. what i want is.. there should be sufficient space between all button like search bar to placed at extreme right, a and A should be in the middle of tool bar.
when i try to drag search bar at extreme right it drags properly but on living of mouse click search bar again comes to it's original position.
How to solve this ?
Any help will be appriciated.

In the Objects panel there are two UIBarButtonItem subclasses named Fixed Space Bar Button Item and Flexible Space Bar Button Item. You need to use those two to adjust your spaces.

Related

how to add a custom button at the center of navigation bar in Swift

In my iOS application, I want to add a custom button at the center of the navigation bar (that the user will be able to swipe left-right to change active topic).
When I searched the web, found that images and title text can be located at the center, the other buttons such back, done, etc. are located at the corners.
Thank you

Common UIToolbar for the required pages - Xcode 8.3

Please suggest that how we can create common UIToolbar(with bar items) for the required pages?
I know that we can add custom UIBarButtonItem in each view controller.
Assuming you use storyboard. First, drag a UIToolBar item to your storyboard.
Next, set up the location of the tool bar. In my example, I put it on the bottom with padding 0 to left, right and bottom. The height is set to be 44
Finally, drag as many Bar Button Item as you want to your tool bar, and then add spaces between them. You can either use fixed length spaces, or the flexible ones (which are used in this example) by simply drag them between the bar button items.

How to reduce spacing between items in Navigation Bar?

In my Swift project I have 2 items on Right Bar but I see that spacing between them is too big. How to reduce it? Or how to move pen icon closer to time icon?
You're not in control of the spacing of separate bar button items. You could make a single bar button item containing a custom view holding two buttons, and then you would be in control of their spacing.

UITableView has blank space below, can't remove

I have a UITableView that displays some data that is read in at runtime and features a button below it that will refresh the list when clicked. All of that works fine, however there is a problem with the layout on the simulator.
When I run, there is a space at the bottom of the table that pushes the refresh button down. No matter how long the UITableView is, the UIButton will always be kept at that extended distance. If I overlay the bottom with the UIButton, it does display with slightly less padding. I am at a loss of how to fix this.
Image with example of behaviour: http://img864.imageshack.us/img864/9913/screenshot20120326at113.png
I think the problem is that in the interface builder your layout does not show at the same size, because it lacks the navigation bar at the top.
In the visual editor, choose the window hosting your table view, go to the attribute inspector, and choose Navigation bar for the Top Bar entry in the Simulated Metrics section of the inspector. The layout of your design will change. Resize your table view, move your button, rebuild the app, and run it again; this should do the trick.
It looks like it's because you're designing without the navigation bar simulated and you've set up your autoresizing masks incorrectly.
What you can do is either enable the simulated metric (attributes inspector in IB with the main view selected) for the top bar set to Navigation Bar, or you can go and fix your autoresizing masks. They are the red things in the size inspector in IB.
It is because when you designed the screen you didn't consider the navigation bar that is gonna come. Simply add a bar to the screen on the top and rearrange the table and button with proper autoresizing masks. It will fit.

Need help on bar button item in xcode

I have the weirdest issue today. I always use toolbar and bar button item button and never have problem. Here is the issue:
I have view and the bottom has toolbar. In the toolbar, I create two bar button items which are 'back' button and 'next' button. For some reason, when i build into simulator or iphone, those buttons are not sensitive like before. On other words, the buttons do not really work. I found out that the half part (top) of the buttons are working when you touch it or use mouse cursor to click it. But the other half (down) of the buttons are not working at all.
Anybody has this kind of issue?
Half of the toolbar means status bar's height. Double check your view's height and change according to your status bar.