Skip to content

Latest commit

 

History

History

Nav-Bar-Title-Transition

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

NavTitleTransitionBehavior.swift

This behavior manages the interactivity between a title, anywhere in a UIScrollView and the title of a UINavigationBar. The behavior is defined so as the title subview scrolls under the title, the Nav Bar's title will translate into place.

This behavior is accomplished by leveraging the UINavigationBar().titleVerticalPositionAdjustment, allowing the title to play nicely with other UINavigationItems, (since it is using the normal navigationItem.title.)

Usage

override func viewDidLoad() {
  super.viewDidLoad()
  navigationItem.setTitle("Title Transition")
  let behavior = NavTitleTransitionBehavior(scrollView: scrollView, titleView: titleLabel)
  addBehaviors([behavior])
}