iOS 11 large-title navigation bar not collapsing
Good news! I've just figured out that if I set "Large Titles" to "Never" on the storyboard, and then set it via code, then it works:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic;
}
Seems like Apple forgot to handle the case when the navigation item has its largeTitleDisplayMode
set via the Interface Builder.
So until they fix this issue, leave "Large Titles" as "Never" on storyboards, and set them via code in viewDidLoad
.
You just need to do that to the first view controller. Subsequent view controllers honor the value in storyboard.
iOS 11 prefersLargeTitles not updating until scroll
I had the same problem. Although you are not using Storyboards but I hope this could help someone. I checked "Prefer Large Titles" for the Navigation Controller (not the View Controller) I embedded my TableViewController in. All the View Controllers after the Navigation Controller turned and had large titles, and it should work.
iOS 11 large title navigation bar snaps instead of smooth transition
I faced same issue - I had UIViewController
embedded in UINavigationController
, the UIViewController
had tableview with leading, trailing, top, bottom constraints to safe area. The whole tableview behaved jumpy / snappy. The trick was to change top constraint of tableview to superview.
iOS 11 large navigation bar title unexpected velocity
I have been debugging this for a couple days, and I have found a workaround.
First, What Was Going On?
It is the UIScrollView
that is not performing well with the largeTitle. Since there is scrolling up on the scroll view at the same time as the navigation bar becoming smaller, there exists twice the scrolling compared to the actual scroll.
I confirmed this by intentionally setting:
scrollView.contentOffset.y = scrollView.contentOffset.y * 0.5
This indeed made it move as desired. But, this couldn't solve the problem entire problem because it did not yield a smooth transition while going from large navigation bar to small navigation bar. You can try the below code out.
if scrollView.contentOffset.y > 0 {
if self.navigationController!.navigationBar.frame.size.height > 44.0 {
scrollView.contentOffset.y = scrollView.contentOffset.y * 0.5
}
}
This worked 'okay' when scrolled slowly, but when you fling downward, it acts slow at first (while navigation height is large), and then speeds up afterwards.
WORKAROUND
Simply put, you CANNOT use UIScrollView
with the iOS 11 large navigation bar. You ought to use UITableViewController
instead.
Since my view is composed of multiple horizontal UICollectionViews
spread along vertically, I used UITableView
with different sections to form the UI using storyboard.
If you use UITableViewController
, it performs as desired.
AppStore and all other Apple-made native apps must do it this way.
Hide large title when scrolling up
For me, it was that if you set the boolean "Prefers Large Titles" in the storyboard to true it will stay large, if you turn this on by code it works as expected!
Related Topics
Initwithstyle:Reuseidentifier: Not Called
Send Image Along with Other Parameters with Afnetworking
Programmatically Highlight Uibarbuttonitem
How to Stop and Resume Background Audio from iPhone App
Possible to Send Automated Email
Get User Swiping Direction in Uipageviewcontroller
Aws Cognito iOS Developer Authenticated Identities
How to Convert Numbers into Text
Error Setting Text in Collection View Cell
How to Show Different Alerts Based on a Condition After Clicking a Button in Swiftui
Swift Dynamic Table Cell Height
How to Determine If a User Has an iOS App Installed
Perform Segue from App Delegate Swift
How to Query Nearest Users in Firebase with Swift
Can't Send Push Notifications Using the Server API
Uitableview Pagination - Bottom Refresh to Load New Data in Swift