Achieving iOS 7.1 UINavigationBar blur - ios

I have another UIView under the navigation bar like this.
I want the slight blur of the navigation bar for that UIView too. Currently I have its alpha value reduced but it doesn't give the desired effect as you can see.
How can I get the frosty look of the navigation bar for the UIView as well? I'm on iOS 7.1.

Don't use a UIView - you will never achieve a consistent result with the navigation bar.
Use a UIToolbar and place it below the navigation bar. Set the delegate of the toolbar to your view controller and implement positionForBar: to return UIBarPositionTop or UIBarPositionTopAttached. You can then add all the subviews you have in your view to the toolbar.

you can use UIToolbar, it's the quickest way.
If you want to customize it, you have to use 3rd library like ILTrasparentView, FXBlurView ...

Related

Cons of using a UIView as a Navigation Bar

In a specific view controller I have content that I need placed in the navigation bar that exceeds the maximum height of the navigation bar. From what I understand since iOS 11 the navigation bar's height cannot be extended.
What are the cons of hiding the navigation bar in this view controller and replacing it with a UIView that looks and behaves like a navigation bar? This way I would be able to fit my custom content.
UINavigationController gives use a lot of default functionality which helps you in the navigation. But if you want to use the UIView in place of navigationBar then you have to write the whole code for each functionality.
No such consequences, when you use UIView in place of UINavigationController/Bar.
You can see what functionality apple offers you https://developer.apple.com/documentation/uikit/uinavigationbar

Common blur effect for top tool bar and navigation bar

I have many ViewControllers inside one NavigationController. In one of ViewControllers I should show toolBar below navigationBar. If simply add it to ViewController with necessary coordinates I have this:
But here is separator between NavigationBar and ToolBar.
If I set clear background and shadow images and set blur effect for navigationBar it is a problem with different blur effects in navigationBar and toolBar:
So is it resolution when there is no imagesShadow in navigationBar and there is common blur effect?
I resolve my problem. Idea of resolution make NavigationBar and ToolBar fully transparent. Next On every ViewController in place of bars and below them I put UIVisualEffectView with common height of bar or bars. So UIVisualEffectView simply should be the highest subview of rootView of ViewController. And here is a problem in case of using UITalbeViewController UITabBarController and so on. In my situation there was only UITalbeViewControllers. Firstly I try to use this resolution. But I had problems with creating of multiple subviews wile navigation via different ViewControllers. Finaly I restructure storyboard. Every TableViewController I have replaced by ViewController with rootView simple view. TableView was subview of rootView. Also I put there VisualEffectView. I have done it for every TableViewControllers.
Here is a sample of structure:
I think there is there better resolution but currently this is optimal.

UINavigationItem Transparency

I have a UINavigationItem (not a UINavigationBar) that I would like to make transparent or not opaque. This gets created when I make a relationship segue root view controller from a Navigation Controller to my UIViewController subclass.
I tried to embed it in a UINavigationBar, but couldn't make that work. There do not appear to be any methods for UINavigationItem that would allow me to change the appearance of its background.
Is there any way to accomplish this, either by embedding it inside a view of some sort or by getting a pointer to some object that has this capability?
Here is the storyboard that shows the hierarchy of the view controller. You can see the UINavigationItem as a direct descendant of the view controller. Notice that there is no explicit reference to a UINavigationBar:
Here is an image of the navigation section at the top of my UIViewController when it renders. I'd like to change the light gray to match the dark gray that you can see just below it:
From the docs:
In iOS 5.0 and later, you can customize the appearance of the bar using the methods listed in Customizing the Bar Appearance. You can customize the appearance of all navigation bars using the appearance proxy ([UINavigationBar appearance]), or just of a single bar.
In iOS 7, a navigation bar’s tintColor affects the color of the back indicator image, button titles, and button images. The barTintColor property affects the color of the bar itself. Additionally, navigation bars are translucent by default. Turning the translucency off or on does not affect buttons, since they do not have backgrounds.

Move navigation bar in navigation view controller in ios7

I want add 20 points margin to my navigation bar. I need it because I want another background color under status bar as youtube did:
I found
iOS Developer library says: Status bar background appearance provided by the window background, if using UIBarPositionTop.
I found solution for toolbar, but I can't move my navigation bar inside navigation view controller. I just set UIBarPositionTop for my navigation bar, but it changes nothing.
-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar {
NSLog(#"position method called");
return UIBarPositionTop;
}
I still see the gray background of status bar instead of white.
Is it possible to do it with a navigation bar or should I use a view with a toolbar?
(XCode 6, development target 7.0+, sdk 8.0, autolayout)
UPDATE: ANOTHER WAY TO RESOLVE PROBLEM
I read this question
and understood, that there is no need to add margin. I added view with background color I need over my navigation bar controller and it resolved my problem.
When you are adding your UIView to the UIWindow, you should change the UIViews size to not underlap the title bar. How to do this is well documented in this post:
Offset on UIWindow addSubview
I hope i understood correctly, look in size inspector, ios 6/7 deltas.
Check this link for an explanation:
Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?

How do I achieve a navigation bar like the one used in iBooks?

The navigation bar in iBooks is exactly what I'm looking to implement. That is, a transparent top bar with the return button in the top left and some buttons in the top right to invoke actions.
However, I'm not exactly sure how this effect would be accomplished. The transparency especially. Can anyone point me in the right direction of how I might accomplish this?
Use a custom UIView subclass. Just add some buttons and set the alpha of the view. Use the controller's UINavigationController to push or pop controllers.The navigationbar should be hidden.
I would not use a navigationControllerBar, I would use a simple UIToolbar to do this. Especially you can have only two button on the navigationControllerBar (left and right button) unlike on a UIToolbar.
The UIToolbar is absolutely customizable, you can set the opacity to 0% and the opaque to NO, after it can be transparent....
With UIView or UIToolbar the alpha is fully customisable. You should subclass one of those two (UIView or UIToolbar), add your buttons and then go from there.

Resources