UINavigationBar jumps from Large Title to small one while pushing to UIViewController with embedded UITableView iOS 11
Asked Answered
G

2

11

As it is said from the title, when I try to push UIViewController with UITableView in it and show LargeTitle, it shows for the very first moment and then hides to the small one.

It's weird but this bug is reproduced on 4 inch devices only.

enter image description here

This behavior is seems to be an Apple's bug.

Any other workarounds or nuances I missed? Thanks for any suggestions.

Uploaded test project (GitHub)

Gymnastics answered 24/9, 2017 at 16:11 Comment(1)
This is really an annoying problem!Nahshunn
G
1

Workarounds I found so far

  1. Attach UITableView's top to SafeArea's top, but this approach lose effect of transparent UINavigationBar and LargeTitle collapses very fast on scrolling
  2. Use UITableViewController instead of UIViewController+UITableView, but this approach loses known flexibility. It's not trivial to hide tableView or add subviews.
  3. pushViewController without animation
Gymnastics answered 24/9, 2017 at 16:11 Comment(4)
The same issue occurs when your view controller is a subclass of UITableViewController. Also, please don't advise others to avoid UITableViewController. If your design presents organized rows of information, and observes Apple's human interface guidelines, you probably should use it, and modify your design to make the most of it. If you "roll your own" (UIViewController+UITableView) you'll either have to continually add code to handle the increasing number of behaviors UITableViewController gives you for free, or ship an app that doesn't feel like it belongs on the platform.Whitish
How do you "attach to SafeArea's top"?Mobcap
@ErikAigner there are 2 ways to do so: 1. you can activate Safe area checkmark in File Inspector in Interface Builder and make constraint from table view top to safe area top, or 2. in code something like view.safeAreaLayoutGuide.topAnchor.constraint(equalTo: tableView.topAnchor).isActive = trueGymnastics
safe area layout guide wouldn't work backward towards lower than iOS 11? The table view will end up having some empty space above the first rowNahshunn
C
0

Just set a table view header of non-zero height for the TableView.

Cove answered 27/6, 2023 at 7:19 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.