1

I'm using the TLYShyNavBar library for my Table View Controller in order implement the navigation bar dynamic contraction when scrolling the table elements. I would like to have an extension view containing a Search Bar plus two additional labels underneath it. Following the examples reported in the guide, the extension view is generated by code (which works fine):

[self.shyNavBarManager setExtensionView:self.toolbar];

but when I use the Storyboard for creating this view the contraction doesn't work properly (To be precise the nav bar contraction behaves correctly but the extension view just disappears where it should instead be contracting progressively).

I would prefer not generating this view programmatically as this makes defining the Auto Layout constraints much more complicated (a bit easier using the Storyboard instead).

Claus
  • 5,662
  • 10
  • 77
  • 118

2 Answers2

5

How are you providing the extension view to self.shyNavBarManager? If you are using an IBOutlet it will already be part of the view controller's view hierarchy, so you'd need to remove it from that first. Also if you are using Auto Layout in your Storyboard then you will need to turn on autoresizing mask translation for the extension view before you add it to the bar manager:

[self.toolbar removeFromSuperview];
[self.toolbar setTranslatesAutoresizingMaskIntoConstraints:YES];
[self.shyNavBarManager setExtensionView:self.toolbar];
idzski
  • 81
  • 2
  • 3
0

This is still an issue in the latest version of TLYShyNavBar. The solution below works:

topTrayView.translatesAutoresizingMaskIntoConstraints = true
shyNavBarManager.extensionView = topTrayView
Sam
  • 49
  • 1
  • 3