Why does [[UINavigationBar appearance] setTranslucent:NO] crash my app?

It seems that the translucent property just can’t be set using UIAppearance. I don’t know exactly why, but I guess some properties just aren’t supported. However, I solved this by creating a custom UIViewController and making all other viewControllers in my app a subclass of that custom viewController. That way, I can set global properties … Read more

iOS 7 | Navigation bar / Toolbar buttons very close to status bar

The navigation bars or toolbars have to be at (0, viewController.topLayoutGuide.length) with bar positioning of UIBarPositionTopAttached. You should set the delegate of your navigation bar or your toolbar to your view controller, and return UIBarPositionTopAttached. If positioned correctly, you will have the result in your third image. More information here: https://developer.apple.com/documentation/uikit/uibarpositioningdelegate?language=objc

iOS 11 SearchBar in NavigationBar

There’s a new searchController property on navigationItem in iOS 11. https://developer.apple.com/documentation/uikit/uinavigationitem/2897305-searchcontroller Use like this… if #available(iOS 11.0, *) { navigationItem.searchController = searchController } else { // Fallback on earlier versions navigationItem.titleView = searchController?.searchBar } In Objective-C the if statement looks like this: if (@available(iOS 11.0, *)) { On iOS 11, if you don’t set navigationItem.hidesSearchBarWhenScrolling … Read more