0

I want to hide the navigationbar but still include a tiny decription, just as Safari or IMDb app. See the image, this is the effect im looking for. How do I show/hide the navigationbar when user starts scrolling, and also include a title. This should be animated, but doesnt need to be gradually animated, so it is enough if an animation is kicked off.

I have looked at multiple answers, such as this one: Imitate Facebook hide/show expanding/contracting Navigation Bar , however it does not describe how to set the small title.

enter image description here

Community
  • 1
  • 1
Zeezer
  • 1,503
  • 2
  • 18
  • 33

2 Answers2

0

Here is the suggestion - on scrolling up you could hide the navigation bar and stick a transparent title view with the title that always sits on the top of the screen (you could add this transparent view to the 'window' if you like). On scrolling down hide the transparent title view and add navigation bar. Hope this helps!

the.evangelist
  • 488
  • 5
  • 18
0

Most solutions to this problem is to "hide the navigation bar and stick a transparent title view with the title that always sits on the top of the screen".

But if you hold Safari's searchBar, the searchBar's background will turn darken (as a sign of been selected), and while you are scrolling up at the same time, you'll find the darken area becomes smaller gradually (and the searchBar is able to respond the touch events while it "disappears"). That is, Apple is not implementing it by simply replacing the navigation bar.

Another way:

  1. Set the scrollView's delegate
  2. In "scrollViewDidScroll:", get the offSet, then change the navigationBar's frame like this:

`navigationBar.transform = CGAffineTransformMakeScale(sx, sy);'

  1. set the navigationBar's frame correctly;
  2. change the background color of searchBar gradually;
  3. change the text color of searchBar's text gradually.

Hope this can help you:)

hengyu
  • 76
  • 4