Claim failed in - [UITableView _addScrollViewScrollObserver:] when using ios 11 big navigation

I have a tab bar controller with a view controller in which there is only a table view.

I set the large title of the navigation bar with the code:

if (@available(iOS 11.0, *)) { [[UINavigationBar appearance] setPrefersLargeTitles:YES]; } else { // Fallback on earlier versions } 

This is an application crash when I open the 2nd time tab. or by randomly shifting tabs with the following message.

The error message is shown below:

 Assertion failure in -[UITableView _addScrollViewScrollObserver:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3694.4.18/UIScrollView.m:7693 

Any idea to fix the problem. Thanks.

+5
source share
1 answer

This method failed [[Appearance of UINavigationBar] setPrefersLargeTitles: YES]; Do not use the method above.

Use the following code in UIViewControllers

 if (@available(iOS 11.0, *)) { self.navigationController.navigationBar.prefersLargeTitles = true; self.navigationController.navigationBar.topItem.title = @"Your Title here"; self.navigationController.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic; NSDictionary *attributes = @{NSForegroundColorAttributeName: [UIColor redColor]}; self.navigationController.navigationBar.largeTitleTextAttributes = attributes; } else { // Fallback on earlier versions } 
+1
source

Source: https://habr.com/ru/post/1273388/


All Articles