UIStepper does not move up when Navigation Bar dissapears - iphone

I am writing a IPhone App. In it there is a search bar (UISearchBar with Controller). When I select it, it gets focussed, and the navigation bar disappears, and the body gets darkened so that when I type on search bar the suggestions (search results) appear. My problem is when I select the search bar, before I type anything, I can see my original view through a tinted black body area. There I see all of my other controls (buttons, textfields) moved up (because navigation bar disappeared), but the UISteppers have not moved, which makes them misaligned.
Why is this ?

It may depend on how you have the relative alignment setup. In your Storyboard, use the Inspector (the ruler icon on the right hand side options) and see if you have set the others to be relative.

I believe this is a bug. I have noticed the same exact behavior in several apps I have worked on (both iPad and iPhone) Storyboard based apps. I have re-produced this behavior on apps with only one orientation. To re-produce, simply layout a scene and add UI elements of different types with at least one UIStepper. Then add the scene to a Nav Controller and all the UI elements will move EXCEPT for any UISteppers.

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.

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.

Best way to show a small view/dialog over an existing screen?

All my views/pages in apps so far have been full screen UIViewControllers that i push and pop from the stack.
I see some apps create a new view/window that appears about the 1/3 the size of the full screen on an iPad, containing tables of items to select or other UI elements. They are commonly used to allow users to filter the current view they were on.
Seeing them in apps, I guess that they are just adding a UIView to there current screen and change its frame depending on where on the screen they want it to appear.
Or am I wrong? Is there another/better way to do this?
I guess you are talking about UIPopovercontroller. There are several tutorials to build the same.check this. Hope that helps you.
It's a little unclear from your question what the view looks like.
If the view is "attached" to a UI element (has a little triangular arrow connecting it to, e.g., a button) and goes away if you tap outside it, then it's a view presented from a UIPopoverController.
If the view overlays everything and dims the content behind it, is likely a model view controller presented with a presentation style of ether page sheet or form sheet.
Both are common and easy to set up. See the class documentation I have linked.
In most cases, these are probably normal modal view controllers whose modalPresentationStyle property is set to either UIModalPresentationPageSheet or UIModalPresentationFormSheet.
Yes you can make your own UIViews and just add them as subviews. Another option for iPads specifically is with the UIPopoverController class.

UIView is shown displaced at the top of the screen

OK, hopefully a stupid question from a newbie...
I have an app that used to display fine base on XIB files created in UI Builder. The .xib still displays fine using the simulator direct from the UIB but when compiled and run, the view is displaced by 40 or 50 pixels (about 1/3 the width of a nav bar) so that I get a bar of white space at the bottom and half my title text hidden on the nav bar at the top.
I have tried fiddling with various parameters for the view and main window (eg layout wants full screen and resize view from NIB) but nothing seems to make any difference.
I tried upgrading xcode from 3 to 4 but no difference.
Any pointers gratefully received...
I don't know about your specific scenario, but layout problems usually boil down to inappropriately specified autosizing parameters.
Pure speculation:
Fiddling around in Interface Builder, in the typical template xib file, you can get two windows to draw your interface on. One of them refers to the window, the other to the view controller. You should leave the window alone. Anything you put in there is placed relative to the window, i.e. the screen. This would typically lead to what you describe.

Button has moved upwards when running app in Simulator

I have a strange problem when developing for the iPhone
There is one window (in green) and one view (in orange)
when I try to test my app it looks like this in the iPhone Simulator
you can see the view have moved upwards
is this normal? and how to solve the problem?
many thanks
You're most likely adding the view incorrectly. You could post some code and I could give you a better idea, or if you just want a quick fix, open the orange view in Interface Builder, make it 480 px tall instead of 460, show the simulated status bar and relayout your image.
In Interface Builder you can specify the simulated User interface elements. In the screenshots above you will notice in the green one you can see the status bar and the red one doesn't have it. You can turn on these elements by setting the properties of the view. Press Command-1 when you have the view selected and you will see a list of simulates ui elements you can add, these include the status bar, navigation controller bar and a few others i cant remember off the top of my head. This will allow you to position your ui elements correctly when you have these other elements on the screen.
The other issue with your view is that it is not the same height. have a look at the dimensions (cant remember exactly which one but its Command-2, 3 or 4 when you have the view selected) it should be 320x480, i reckon yours is 320x460... (20 pixels, the height of the status bar)