How can I add a toolbar to the top of my iPhone app's screen without it looking like it's upside-down? - iphone

when i add a toolbar in IB to the top of the screen, the toolbar style is upside down (border at the top of toolbar and no border at the bottom).
is there any way of changing the toolbar so it looks normal and the border is at the bottom? I cant seem to find a way of doing it in IB, am i going to have to code it?

You're breaking the Human Interface Guidelines if you try and put it at the top.
On iPhone, a toolbar always appears at the bottom edge of a screen or view, but on iPad it can instead appear at the top edge.
So the toolbar always looks like that on iPhone. Breaking the HIG in this way is likely to get your app rejected from the app store.

Related

UISegmentedControl inside UIToolbar does have wrong height for Lanfscape

Somehow the Segmented Control does not get the proper height when the iPhone is in Landscape.
It is already bad enough when rotating the simulator that the toolbar at the bottom doesn't get thinner height, but when navigating back to the previous screen and then in again, the toolbar does get the propper height, but the segmented control extends above it, and even looks much bigger.
Is the is bug in the simulator or am i doing something wrong?
After digging around another day, I found where it all went wrong!
When dealing with UINavigationControllers, DO NOT drag in a UIToolbar at all! UINavigationController comes with two bars, a top-bar for the Navigation Controller and a bottom-bar for the ToolBar - that latter one is hidden by default.
In any newly added ViewControllers, there will be a toolbar that can be populated from the IB. However, if it is not a UIBarButton, there are some issues. To use a stepper, on/off-switch or a segmented control, drag it first to the Navigation bar, and then in the left column navigator of IB, drag it to the toolbar.
This solved all the problems mentioned before

UIViewController Nib Layout changes at runtime

Notice the Nib on the left displays a layout with 2 UILabels, 1 UITextView and 2 buttons. The Y coordinate of the buttons changes at runtime. What is causing this and how do I fix it?
Update #1 - Problem goes away when I shift to a iPhone Retina 4-Inch display.
Update #2 SOLVED - Problem goes away when by unchecking 'Autolayout' in the xib properties.
It looks like you're using iOS 6 and a storyboard with the 4-inch "tall" iPhone screen form factor simulated. Assuming you are using Auto Layout, you probably have a constraint added to one or both of the buttons that pins them to the bottom of their superview. When you then run your app on the 3.5" screen iPhone simulator, the buttons appear to "move up" as their superview has gotten shorter than on your storyboard.
Find the button with the icon pictured below while editing your storyboard, and click it to toggle the simulated screen size between the 3.5-inch and 4-inch form factors. You should see your buttons re-layout based on their constraints.
To set your buttons' spacing relative to the top instead of bottom of their superview, select both buttons and from the menu bar choose the Editor menu > Pin > Top Space to Superview. (Or use the Pin button pictured below directly from the storyboard.)
There's a good introductory tutorial to Auto Layout here, if you haven't learned about it yet.

Align icons TabBar

Well I have a problem,
I'm doing the reverse for my iPad app, but I want my tabbar is exactly like this:
I'll put the volume controls, play and pause on the left and right side of the tabbar icons ....
how can I change the position of them?
For alligning the elements, you should take a look at this question:
Aligning UIToolBar items
I'm not sure how to add custom controls to a UIToolbar, but I'd expect you could do this by setting their frame to overlap the UIToolbar.

Is it possible to cover UIStatusBar with a view while maintaining scrollsToTop functionality?

I want to display a message to the users of my app in the UIStatusBar, but I'd like to maintain the scrollsToTop functionality so a user can tap on the statusbar and scroll a tableView up to the top.
I've looked into adding a UIWindow on top of the current status bar as in this question: Add UIView Above All Other Views, Including StatusBar
But it disables the touches to the status bar.
Note: I've seen several apps that use the statusBar area to display messages such as the "Evernote" app.
Thanks for the help!
Have a look at https://github.com/myell0w/MTStatusBarOverlay. By pressing it it can be toggled to not cover the whole status bar and then you can toch the status bar and get back the scroll-to-top feature.
Here is a screenshot, the left side shows the expanded version, the right side the shrinked one:
Are you hiding the statusBar ? It's unwise to keep it there but draw into its position, because in different countries, with different mobile operators, the statusBar's elements have a little different positions. I've seen app drawing there over status icons. Ugly!
So I guess you want to add a subview at the position of statusBar. Why don't you intercept touch events in that view and send your tableView a message to scroll to the top ?

Is it possible to change the frame origins of an iPhone screen as is done when a statusBar is shown or hidden?

When a UIStatusBar is hidden in an app, the origin of all views is (0, 0), the upper left hand corner of the screen. However, when a statusBar is shown, the origin is still (0, 0) yet the views will move down as not to cover the statusBar.
How is this working? Is it possible to duplicate this effect in code?
Essentially, my end goal is to hide the statusBar and replace it with a UIView at certain points in the app (like the google app). But I have a LOT of views and don't want to have to resize all of them after the statusBar is hidden.
You could create a container view enclosing all your "normal" views and set autoresizing masks everywhere. That way, shrinking your container view will automatically resize everything else. In fact, this is how UIViewControllers work. But be aware that while standard Apple controllers like UINavigationController know how to deal with the status bar, they don't know anything about what you want to do, so they're going to be confused more often than not.
Alternatively, you can always show your own status bar underneath the real one, hiding the latter when needed. But in this case you will have to fight Apple-provided controllers which will try to expand when you hide the status bar. You can also play with a two-window layout where the top window does not overlap the status bar, but I'm not sure it will be any easier.
Since Apple doesn't support any of the above, expect a lot of things to stop working correctly. Perhaps, the very best approach is to rethink your UI design.