andreamazz / AMScrollingNavbar

Scrollable UINavigationBar that follows the scrolling of a UIScrollView
MIT License
6.05k stars 633 forks source link

Need prefersStatusBarHidden in ScrollingNavigationController #344

Closed StefaniOSApps closed 5 years ago

StefaniOSApps commented 5 years ago

Describe the bug I want to hide the UIStatusBar at some UIViewControllers. The Problem is I use the popular RESideMenu framework with more than 7k stars (https://github.com/romaonthego/RESideMenu).

The structure is:

  1. ScrollingNavigationController
  2. present a RESideMenu controller with 2.a UIViewController (left) 2.b UIViewController (right) 2.c UIViewController (content - center)

The RESideMenu ask the ScrollingNavigationController which state the prefersStatusBarHidden has. So I need this feature. [[UIApplication sharedApplication] setStatusBarHidden:YES]; is deprecated since iOS 7. Only prefersStatusBarHidden works.

I will create a PR with this feature. So can set this state by shouldPrefersStatusBarHidden. Default is false.

andreamazz commented 5 years ago

Subclass the ScrollingNavigationController and override that property (as you would with a common UINavigationController). There is no need to add another property.

StefaniOSApps commented 5 years ago

did you remember ? https://github.com/andreamazz/AMScrollingNavbar/issues/327#issuecomment-428852427

andreamazz commented 5 years ago

Write your subclass in Swift.

StefaniOSApps commented 5 years ago

... My complete project is in Objective C, so I'd like to favor this feature. Otherwise I would have to write my own subclass for this single feature. Do not you think that this is unnecessary? It would make me really happy :-) This also applies to others.

andreamazz commented 5 years ago

... My complete project is in Objective C,

You are using this library, so it's not really just ObjC. At any rate, the two languages are interoperable, so I fail to see the issue.

Otherwise I would have to write my own subclass for this single feature.

Like you would if you'd use a plain UINavigationController. Should I add a property for every possible override? It would pollute the API, that I intend to keep as close to the default implementation of the nav controller as possible.

StefaniOSApps commented 5 years ago

Right, I use Swift Frameworks. But not in my main project with more than 50 UIViewControllers. The reason is simple. Swift was very often modified by Apple Inc. Objective C is more consistent.

I do not think that will pollute the framework. Also the successful framework RESideMenu with more than 7000 likes uses this feature (https://github.com/romaonthego/RESideMenu). This is also a specific UINavigationController extension.

bildschirmfoto 2018-10-19 um 22 50 49
andreamazz commented 5 years ago

He does that because there's some extra logic behind it: it's hidden (or not) when the menu is visible, and that's a piece of information that shouldn't be handled by the library user. It make sense in Roman's library, not in this one. The decision is final.