5
votes

I would like to subclass UINavigationController to include a few types of headers that can transition from one to the other. I'm deliberating on a few things in the design:

  1. How should I manage the size of the child controller views? Constraining them to the bottom of each kind of header seems chunky and difficult to manage during transitions.
  2. I tried assigning a UIView subclass to the UINavigationController's view in loadView(), but doing so causes child controller views to not display (it appears black instead). Why does this unexpected behavior occur?
  3. How do I support the "drag from left to right" transition of UINavigationController?
  4. Is there a way to achieve this by subclassing UINavigationBar? If not, how can my custom view support UINavigationController's transition animations?
  5. Would there be any advantage to subclassing UIViewController instead and writing my own implementations of the basic UINavigationController behaviors?

Header 1

Header 2

1

1 Answers

0
votes

I understand that using these methods is not enough:

func setBackgroundImage(UIImage?, for: UIBarMetrics) and set any view to the titleView to insert a View in the title area.

Nor setting the navBar as transparent and only have the barbuttons and titleview show over the child view.

Check the UINavigationBar and UINavigationItem documentation