How to subclass a UINavigationController with a custom header or UINavigationBar?

I would like to subclass the UINavigationController to include several types of headers that can go from one to another. I reflect on a few things in design:

  • How do I control the size of the views of the child controller? Limiting them to the bottom of each type of heading seems short and difficult to manage during transitions.
  • I tried to assign a subclass of UIView in the UINavigationController view in loadView (), but the views of the child controller are not taken into account (it looks black instead). Why is this unexpected behavior happening?
  • How can I support the transition between the UINavigationController drag and drop from left to right?
  • Is there a way to achieve this by subclassing the UINavigationBar? If not, how does my custom view support UINavigationController transition animations?
  • Will there be any benefit to subclassing the UIViewController and writing my own implementations of the main UINavigationController behavior?

Heading 1

Heading 2

+4
source share
1 answer

I understand that using these methods is not enough:

func setBackgroundImage(UIImage?, for: UIBarMetrics)and set any view to titleViewto insert the view in the title bar.

Do not install navBar as a transparent and show only the tags barbuttonsand titleViewfor the child mind.

UINavigationBar UINavigationItem

0

Source: https://habr.com/ru/post/1678314/


All Articles