Apple News app scrolling buttons in UINavigationBar - ios

How to implement such a navigation bar? I am aware of the title view but not aware of any subtitle view.
One way I can think of is setting UINavigationBar shadow image to nil and place collection view below the navigation bar. But that won't give me translucency of Navigation bar.
Is there a native way (which may have been introduced in iOS9) of doing so?

I think you'll have to make custom view and will have to use it as navigation bar. Hide the default navigation bar and use your custom view.
I wanted to make the nav.bar as shown in picture with the functionality like tab bar and i've made custom view for that purpose.

You can use a library like PageMenu or PagingMenuController to do this easily.

Related

New UINavigationBar appearance in detail pane of UISplitViewController in iOS 13

Under iOS 13, if you setup a scrollable root view controller (such as a UITableViewController) in a navigation controller and then put that navigation controller in the detail pane of a UISplitViewController, then the nav bar's background isn't visible when the scrollable content is at the top.
You can see this by creating a new iOS project based on the Master/Detail template. Then modify the storyboard to use a UITableViewController inside the detail pane's nav controller. Put the device/simulator in Light Appearance mode (it shows the problem better than Dark mode). Run the app and notice the nav bar area is the same color as the table view background. Now scroll the table view up and the nav bar color changes to the standard light gray. Let the table view return to the top and the nav bar color disappears again.
I've only seen this in the detail pane of a split view controller.
How do you turn off this "feature" so that the nav bar looks normal just like every other nav bar used anywhere else other than the detail pane of a split view controller?
There are no relevant API changes for UISplitViewController or UISplitViewControllerDelegate. There's nothing in UINavigationController either.
After some digging I found one workaround but I'd love to find a way to avoid having to do this.
The UINavigationBar class now has some new properties for setting its appearance. Oddly, none of these are mentioned under the "Customizing the Appearance of a Navigation Bar" in the documentation for UINavigationBar.
There are three new properties in iOS 13:
standardAppearance
compactAppearance
scrollEdgeAppearance
All three are of type UINavigationBarAppearance.
Only the first one is set by default.
Even though scrollEdgeAppearance is nil, the detail pane of a split controller acts as if this has been set with the backgroundColor set to the clear color.
So the workaround is to add the following line to the viewDidLoad method of the navigation controller's root view controller:
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
Why is this needed only in this one case? Is there a more correct solution other than adding this code?
I noticed that none of Apple's apps (Mail, Notes, and Files at least) seem to use this "feature".
The workaround you found is the 'official' way to disable this behavior, as explained in a thread on Twitter by David Duncan who is on the iOS System Experience team at Apple.
to control what happens when the UINavigationBar is completely
unfurled, you want to set the scrollEdgeAppearance. By setting
standardAppearance and scrollEdgeAppearance to the same values, you
will get a bar that doesn't change.
An Apple app that does not disable this behavior is the Settings app.

How to link customized navigation bar to navigation controller?

I created a normal view controller with a customized navigation bar. Later I changed my mind to embed the view controller into a navigation controller. And I noticed that embedding the view controller into a navigation controller will create another navigation bar!
As the image show:
I am wondering if there is a way to replace the navigation bar created by navigation controller with my own customized bar?
Or, if it's not possible, is there a way to configure the new navigation bar? Because for some reason it's not shown in my interface builder.
You have 2 solutions
Hide the system navigationbar using below code so it was display your custom navigation.
self.navController.navigationBarHidden = YES;
Customize the system navigation bar with its background color, back button and title text color. For this you can refer a below links which provide you detail of its
http://www.appcoda.com/customize-navigation-status-bar-ios-7/
You can change the color and buttons of the UINavigationBar provided by the system and make it look like yours.

How to add a top bar to the view?

I am in the designing of ios view. I would like to add a top bar.
I know I can use navigation bar, but I am not sure if this is the prefered way. I think I don't need home button.
Just using the navigationItem in the xib file,and setting its property,but not using NavigationController.

iOS. Navigation controller toolbar - customize example

I'm newbie with Xcode, I'm learning it and trying to make my app.
Now I would like to put Navigation Bar func at the bottom of the screen with some customize.
I turn on "Shows Toolbar" at Navigation Controller and put my button there, but I cannot customize it.
Everything that I found about customizing Navigation Bar at the top of the screen or about customizing TabBar when people are talking about bottom of the screen.
Please, can you give me a code examples to build something like this at the bottom of the screen:
https://dl.dropboxusercontent.com/u/1338320/nav.png
Thanks in advance!
I'm not sure what you are trying to customize (button or bar) but when there is a bar at the bottom of the screen that is not a tab bar it is a tool bar not a navigation bar. The two are related but they each have their own class. Tool bars use UIToolBar not UINavigationBar. The tool bar is independent of the navigation controller and the two work together well. For any views that don't want a tool bar just set it to hidden in -viewDidAppear: (you will need to un hide it in views that use it).
dimimpou is right. You can accomplish this by using a UITabBarViewController and one UIBarButtonItem for "ADD ONE" and "MY STATS".
If you get lost in references(I sometimes get lost too), I may provide a simple example.
Note that if the interface provided by UIKit doesn't meet your need you can:
Use category over UITabBar or UITabBarItem.
If 1. doesn't work sadly you'll have create your own view controller which is simulate UITabBarViewController(requires some time, but it's worth)
Edit:
You can use a UINavigationController inside a UITabBarViewController.
You can easily do this. The way I understand it, you want this "Toolbar" to show from a button in the navigation bar. Just put a tab bar with what you need and make it show when the user presses the button on the navigation bar. on this buttons action put this code: self.tabBar.hidden = NO; and on the storyboard uncheck the bar visibility option. Hope it helps!

Custom navigation controller and navigation bar?

I am well aware of how to implement my own drawing of a navigation bar. What I want to active is something similar to the Jetsetter iPhone application. Which has a very nice animation when swapping between view controllers (in a similar way you would push/pop view controllers in a UINavigationController stack).
Would this require a complete rewrite of the UINavigationController or could I somehow just override some vital parts?
I would be great full for any information right now.
Thanks
In my opinion, they hide the navigation bar and roll their own view.
Please check this link.
On some views they are not using a navigation bar, they are just creating a simple view and adding buttons for popping and pushing, but on some views, they change the navigation bar background and initialize the backbarbutton and forward button items and title with their own views and then add gestures recognizers to these, its very simple.

Resources