I'm trying to create a navigation bar that looks like (and with the same behaviour) of the Apple one used in the Calendar App. In particular (see pictures below):
Starting navigation bar
Ending navigation bar (after push)
I have tried to subclass the UINavigationBar and override the sizeThatFits(rect:CGrect)
method. This will increase the bar hight but the result with the custom view is not ok, as well as the animation between the "pop/push" and the button alignments (the button stay aligned down instead of up). That solution seems to be a real mess.
Do you now a better solution to embed a custom view in the navbar (exactly how is represented in the images) and make this view part of the navbar animation as well?
edit
I also find these olds questions that may be useful: Change iPhone navigation bar's height, Change UINavigationBar Height,
Also the resizable-navigation-bar that you can find here on GitHub can be useful
Better solutions are welcome
I maybe found a good solution provided by Apple itself to fix this "problem".
HERE you can find a sample code about how customise UINavigationBar
without interfere too much with orientation, retrocompatibility etc..
Just download the sample code and see the Extended Navbar Example.
If few words they create a custom view attached to the navigation bar that looks like the navbar itself. Apple explain clearly:
This example demonstrates placing a custom view underneath the navigation bar in such a manner that view appears to be part of the navigation bar itself. This technique may be used to create an interface similar to the iOS Calendar app.
I still don't understand how to achieve the correct push animation with this solution but it could be a good starting point. Anyway, this is NOT an embed view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With