Need help on bar button item in xcode - iphone

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.

Related

Odd UIBarButtonItem behaviour

Try the following in the simulator or a device.
Create a new Master-Detail application for iPhone or compare any app that uses navigation bars. iOS 5 or 6, don't matter.
In the case of the template: Let it run,create an entry using the plus button and open the entry.
Now touch the area below the navbar directly under the UIBarButtonItem thats leads back.
Even when the button nor the navigation bar is clearly not touched, the button will activate and the view does return.
This is way beyond the 44x height of the navbar.
What is happening here?
Why does this button respond way beyond his frame?
Cant find an info about this in the HIG.
iPhone
The area you can press to activate the back button is actually larger than the actual pixels of the button to accommodate the average thickness of fingers. (The actual number of pixels is buried somewhere in Apples HIG. I think it is 44x44.) This is expected behavior.
iPad
The master view controller is automatically dismissed when you tap outside it. This is expected behavior.

Add space to toolbar in 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.

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.

UISearchBar: how can I stop it resizing when clicked?

I have a UISearchBar (with UISearchDisplayController) as title view of UINavigationBar. There are also two buttons on either side of the searchbar within the navbar.
When clicking on UISearchBar, it becomes wider and covers the button on the right of it.
How can I stop it from becoming wider?
Things tried but didn't work -->
The widened search bar then becomes the original size if the device is rotated.
So, tried calling [searchBar setNeedsLayout] in -searchBarTextDidBeginEditing
All different auto-resizing mask options in IB
Edit: Didn't mention, but this is on iPhone (as we can put searchbar inside toolbar in iPad..)
Actually, taking hint from this answer if the search bar is put in UIView of desired size then this is set as title view of NavBar, it doesn't go wider !
But... Since you can't make cancel button to show/not show as you wish, I realized it's not so useful.
(As seen in this question/answer etc)

UIButton disabled when covered (or semi covered) by a view

I have a view that holds some UIButtons. Another view covers and hides the buttons. When the top view slides off to reveal the buttons (with an animation).. the UI draws the buttons grayed out until the top view no longer covers or overlaps the buttons at all.. causing an undesirable flicker from gray to the normal button color (white).
is there a way to keep the UIButton from rendering itself disabled while covered or semi covered by another view?
I dont think that its correct that a button is disabled while covered. What is happening is that when its covered, touch events are prevented from getting to the button, so the button cant get pressed. If the button is only partially covered, touch events to that part that are not covered can be received by the button and the button can be depressed. If you really wanted the button to work while it was covered (maybe you can relayer your views so the button is in front of the view instead of behind it?) you could hack your view and void its hit testing so it doesnt capture the touches.
Well, in lieu of actually finding the correct answer, I simply swapped out the buttons with UIImageViews and attached UITapGestureRecognizers to them... this solved the problem.