Navigation bar Height, what is the best solution to set height? - objective-c

When you use View that related to Navigation Controller, it will have Navigation Bar more high, but what to do if my view is based on Tab Bar Controller ? The Title Text possition is almost jam the timer on status bar. Is it possible to adjust margin or padding, or even adjust the Navigation Bar height ?
LINK TO IMAGAE

I set the Storyboard like this:
Tab Bar Controller--->Navigation Controller--->myView
Yezzz, it works. But I am not sure if this is the wrong way ? If not this is very good news for me.

Related

How animate the title / buttons in the UINavigationBar

I have in the UINavigationBar status information about the health of the app. It change the title text color, and one of the buttons there.
The changes work fine, but I wish to provide a smooth animation (because the status update on data changes) but don't know how. I'm not asking about moving to another views, but about how animate only the UINavigationBar titles & buttons.
I don't think you can animate those things without some extra work.
A navigation bar is a complex beast, and by default the UI objects that appear on the screen are private and maintained by the navigation bar or the current navigation item.
There should be a way to make it work however.
The current navigation item has a property titleView. normally it's nil and the navigation bar displays a title string itself. But if you plug a UILabel into the titleView property then you should be able to do animations on the animatable properties of the titleLabel.
Likewise with the bar button items.

How to create a tall cutom navigation bar

I want to create a custom navigation bar like that
Here is a default translucent navigation bar. I want to add a new view with the same background color as in the navigation bar below the navigation bar. But i don't know what is the actual colour of the navigation bar. Or maybe there is other way to create a custom navigation bar.
Update
I need different presentations of a navigation bar for different view controllers inside one navigation controller. Also a navigation bar should have different functionality for different controllers, that is why I don't think that subclassing a UINavigationBar is a good idea.
I found the answer in this answer. I removed a bottom border from a navigation bar, placed a blur view below the navigation bar and added a bottom border to it.

How to make the status bar translucent in iOS 7?

In my app, I have some webviews. A transparent status bar doesn't look good for full screen webview. I want to make the status bar TRANSLUCENT, just like the game center.
I notice that the status bar would be drawn translucent if there is a navigation bar under it. But I want a translucent status bar BY ITSELF.
Is there any way to do this?
If you look at the Human Interface Guidelines section about the Status Bar it recommends (emphasis mine on the section most related to your question):
Prevent scrolling content from showing through the status bar. As
users scroll, you don’t want them to see a confusing mix of app
content and status bar items in the status bar area. To give users the
impression of spaciousness while still ensuring maximum readability,
make sure the status bar has a background that obscures the content
behind it. Here are a few ways to keep scrolling content from showing
through the status bar:
Use a navigation controller to display content. A navigation controller automatically displays a status bar background and it ensures that its content views don’t appear behind the status bar. (To learn more about navigation controllers, see “Navigation
Controllers”.)
Create a nondistracting custom image—such as a gradient—and display it behind the status bar. To ensure that the image stays behind the status bar, you could use a view controller to keep the image above a scrolling view or you could use a scrolling view to keep it pinned to the top.
Position content to avoid the status bar area (that is, the area defined by the app’s statusBarFrame property). If you do this, you should use the window’s background color to provide a solid color behind the status bar.
As the status bar is totally transparent and any content can go on top of it, I just create an empty UIToolbar that is 20px height which just looks like a perfect translucent background for the status bar.
This is not an ultimate solution, but it really helps and it is very easy to implement when you don't need a real tool bar.
Thanks to Apple that they do not provide an option to set the status bar from transparent to translucent.
In Xcode 6, create top, bottom, left, right constrains and set the
- constants to 0
- priorities to 749.
- Don't forget to UNCHECK the "Constrain to margins" check box.
How to create constrains?
At the bottom right of your storyboard window, there's four buttons. The second from your left has the constrains. Please google about constrains in Xcode 6 since it's a kinda new feature.
Hope this help,

Can we put tab bar on top>?

Say I like tab bar style button and I want to put it somewhere on the screen.
Can I do that?
This the the documentation for tabbar
Provides a mechanism for displaying a tab bar at the bottom of the screen and supports the display and selection of tab bar items (instances of UITabBarItem). You can use UITabBarDelegate to specify custom views for tab bar items.
Yes, you can put it at the top, but it's probably against the HIG. However, I don't understand the intent of your question -- you obviously tried putting it at the top, so why ask a question to which you already know the answer?
No. By definition, tab bars go on the bottom of the screen -- the top is reserved for navigation bars.

Use custom Navigation Bar in iOS

I added a Navigation Bar to the .xib.
I did that because I want to customize a lot of things of it. I want my navigation controller to use that navigation bar in that screen.
I created the outlet named navBar and did:
[self.navigationController.navigationBar = navBar;
But it says that navigationBar is readonly. Is it possible to link my existing navigation controller with the navigation bar that I added to the screen?
It sounds to me that you may not actually want to use a UINavigationBar. As it states in the reference documentation:
The UINavigationBar class implements a control for navigating hierarchical content. It’s a bar, typically displayed at the top of the screen, containing buttons for navigating up and down a hierarchy. The primary properties are a left (back) button, a center title, and an optional right button. You can specify custom views for each of these.
So if you're planned customizations go beyond adding buttons, changing it's color / background, opacity, hiding etc.. you might be better off creating a UIView that mimics the look & feel of a navigation bar.
Here's an example of how to give your UIView that gradient look of a navigation bar.
It's far more flexible and actually quite easy to do BUT you've got alot of reading and testing ahead of you :).
Just in case if it's just buttons you're thinking of adding you might be better off using UIToolbar instead
You can't do that. Since the navigation controller's navigation bar has a lot of settings embedded, it's a readonly property and you shouldn't be able to change it.
What exactly are you trying to achieve that you need to do that via interface builder. I mean, with the newest APIs, it should be simple to do everything you want with a few lines of code, by customising the original navcontroller's navbar.
You would not manage a navigation bar in interface builder. Also, you would not try to set the navigationBar property of the navigation controller.
To make changes you would make changes to the navigationItem property of the navigationBar
[self.navigationController.navigationBar setItems:newNavItems];
You can also make other changes to the navigationBar such as setting a background image or making it translucent
self.navigationController.navigationBar.translucent = true;
[self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:barMetrics];