A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag

Overview

HidesNavigationBarWhenPushed

A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag.

FYI: I use Apple internal API to make it work. Please remember that Apple might reject your app during app review process.

Context

While hacking on various projects, time to time I get designs where view controller A has navigation bar, and view controller B doesn't have it. It was always a pain to make it work. I decided to hack on that – and this is the result of that.

I hope that many people will find it useful too.

Demo

With interactive pop gesture recognizer

Regular push and pop

Requirements

  • Xcode 9 or higher
  • iOS 11.0 or higher (may work on previous versions, just did not test it)
  • ARC
  • Swift 4.1

Example project

Open and run the HidesNavigationBarWhenPushedExample project in Xcode to see HidesNavigationBarWhenPushed in action.

Installation

CocoaPods

pod 'HidesNavigationBarWhenPushed'

Manual

Add HidesNavigationBarWhenPushed folder into your project.

Usage

  1. Use provided NavigationController instead of UINavigationController
  2. Use provided ViewController instead of UIViewController
  3. Use provided NavigationBar instead of UINavigationBar (make sure you specify this explicitly when using Interface Builder)

ViewController contains a single property you have to worry about: hidesNavigationBarWhenPushed.

If value on the new view controller is set to true and on the current view controller is set to false, then when new view controller is pushed, navigation bar will remain in the previous view controller. If value on the new view controller set to false and on the current view controller is set to false, then when new view controller is pushed, navigation bar will be present only in the new view controller, but not in the current.

If it sounds confusing, please see the demo above.

Contributions

Contributions are always welcome!

Contact

Danil Gontovnik

License

The MIT License (MIT)

Copyright (c) 2018 Danil Gontovnik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
A framework that provides CurtainController. CurtainController is a container view controller that implements a content-curtain interface. You can find a similar implementation in applications like Apple Maps, Find My, Stocks, etc. Someone calls it
A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI.

A set of UIKit helpers that simplify the usage of UIKit view's and controller's in SwiftUI. Many of these helpers are useful even in a pure UIKit project.

Page view controller with bounce effect
Page view controller with bounce effect

BouncyPageViewController Page view controller with bounce effect inspired by motion design by Stan Yakushevish. Quickstart Create a queue of UIViewCon

iOS custom controller used in Jobandtalent app to present new view controllers as cards
iOS custom controller used in Jobandtalent app to present new view controllers as cards

CardStackController iOS custom controller used in the Jobandtalent app to present new view controllers as cards. This controller behaves very similar

ElongationPreview is an elegant UI push-pop style view controller
ElongationPreview is an elegant UI push-pop style view controller

ElongationPreview is an elegant UI push-pop style view controller

📖 A simple, highly informative page view controller
📖 A simple, highly informative page view controller

TL;DR UIPageViewController done properly. ⭐️ Features Simplified data source management & enhanced delegation. Dynamically insert & remove pages. Infi

Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.
Provides an iOS view controller allowing a user to draw their signature with their finger in a realistic style.

Swift version now available! Mimicking pen-on-paper signatures with a touch screen presents a difficult set of challenges. The rate touch events are e

Meet Page View Controller for iOS by Cleveroad
Meet Page View Controller for iOS by Cleveroad

While a standard page view allows you to navigate between pages by using simple gestures, our component goes further

A Swift material design UI module which paints over the parent view when the switch is on.
A Swift material design UI module which paints over the parent view when the switch is on.

:octocat: 🎚 RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion

Owner
Danil Gontovnik
Co-founder at Kaizen. Ex SWE @ FB, MSQRD 🇬🇧 London
Danil Gontovnik
Beautiful flag icons for usage in apps and on the web.

FlagKit Beautiful flag icons for usage in apps and on the web. All flags are provided as stand-alone PNG and SVG files. FlagKit also provides an Asset

Bowtie 2.9k Dec 29, 2022
A controller that uses a UIStackView and view controller composition to display content in a list

StackViewController Overview StackViewController is a Swift framework that simplifies the process of building forms and other static content using UIS

Seed 867 Dec 27, 2022
A simple way to hide the notch on the iPhone X

NotchKit NotchKit is a simple way to hide the notch on the iPhone X, and create a card-like interface for your apps. Inspired by this tweet from Sebas

Harshil Shah 1.8k Dec 5, 2022
SwiftUI-Margin adds a margin() viewModifier to a SwiftUI view.

SwiftUI-Margin adds a margin() viewModifier to a SwiftUI view. You will be able to layout the margins in a CSS/Flutter-like.

Masaaki Kakimoto(柿本匡章) 2 Jul 14, 2022
Infinite paging controller, scrolling through contents and title bar scrolls with a delay

PageController PageController is infinite paging controller, scrolling through contents and title bar scrolls with a delay. Then it provide user inter

Hirohisa Kawasaki 408 Nov 28, 2022
SwiftUI view enabling navigation between pages of content, imitating the behaviour of UIPageViewController for iOS and watchOS

PageView SwiftUI view enabling page-based navigation, imitating the behaviour of UIPageViewController in iOS. Why SwiftUI doesn't have any kind of pag

Kacper Rączy 365 Dec 29, 2022
UIView and CGRect extension that adds properties to manipulate them efficiently

Geometry Geometry is a UIView and CGRect extension that lets you work with view and rect geometry easier. It adds the following properties to UIView:

Tuomas Artman 92 Sep 7, 2022
A UITextView subclass that adds support for multiline placeholder written in Swift.

KMPlaceholderTextView A UITextView subclass that adds support for multiline placeholder written in Swift. Usage You can set the value of the placehold

Zhouqi Mo 794 Jan 7, 2023
A nice iOS View Capture Swift Library which can capture all content.

SwViewCapture A nice iOS View Capture Library which can capture all content. SwViewCapture could convert all content of UIWebView to a UIImage. 一个用起来还

Xing Chen 597 Nov 22, 2022
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Christoffer Winterkvist 246 Dec 28, 2022