Reputation: 42776
In StoryBoard, if we were using UINavigationController
, the embedded UIViewController
, will automatically come with a title bar, with horizontal separator.
If we are using XIB, it is not possible to place UINavigationController
in XIB. Hence, in order to have title bar. We need to place it manually.
However, with such approach, I am not getting the horizontal separator as shown below.
May I know if I were using XIB, how can I have a horizontal separator below title bar, without using UINavigationController
?
Upvotes: 0
Views: 287
Reputation: 77672
Change the order of the views in the view hierarchy...
Here's how it looks in the order you've setup:
output:
If we move the Navigation Bar to the bottom of the list of subviews - thus bringing it to the Top of the view hierarchy:
It now looks like this:
Upvotes: 1
Reputation: 4764
Actually , NavigationBar has already a horizontal seperator but you couldn't see because of your collectionview
'under the navigationbar
' top constraints might be zero. That cause collectionview covers the horizontal seperator.
When you use NavigationController
all the componens in viewcontroller settle down under the navigationBar
but if you use like you posted , They all in the same line . Thats why giving zero top constraints make causes the cover horizontal seperator.
You can change the top constraints of collectioview and you going to see the seperator.
Upvotes: 1