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

Unable to hide the navigationBar when embedding SwiftUI in UIKit

UIHostingViewController respects the navigationBarHidden value of your SwiftUI view. You can either call .navigationBarHidden(true) at the end of your SwiftUI view, or you can use the custom UIHostingController subclass shown in the example below. Solution: import SwiftUI import UIKit class YourHostingController <Content>: UIHostingController<AnyView> where Content : View { public init(shouldShowNavigationBar: Bool, rootView: Content) { super.init(rootView: … Read more

How can I change Drawer icon in flutter?

This should work. Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title:Text(‘hi’), leading: IconButton( icon: Icon(Icons.accessible), onPressed: () => Scaffold.of(context).openDrawer(), ), ), ); From the docs -> {Widget leading} Type: Widget A widget to display before the How can I change Drawer icon in flutter?. If this is null and [automaticallyImplyLeading] is set to true, … 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

How to add image in UINavigationBar in IPhone app

One way to do this is to use UINavigationItem.titleView and UINavigationItem.rightBarButtonItem. Like this : viewController.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”yourimage.png”]]; UIBarButtonItem * item = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@”yourimage2.jpg”]]]; viewController.navigationItem.rightBarButtonItem = item; Here I am using UIImageView as custom view, but it can be UIButton with custom image.

How can I change the font of the back button for my navigation bar?

If you need to change font style entirely across you app (aka. each navigation button), preferred method is to use UIBarButtonItem.appearance() proxy. Sample code snippet would look like this: SWIFT 3.0+ //make sure font name u use below *actually* exists in the system ! //if it doesn’t app will crash because we’re force unwrapping an … Read more

Change UINavigationBar font properties?

From iOS 5 onwards we have to set title text color and font of navigation bar using titleTextAttribute Dictionary(predefined dictionary in UInavigation controller class reference). [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor], NSForegroundColorAttributeName, [UIFont fontWithName:@”ArialMT” size:16.0], NSFontAttributeName,nil]]; The below tutorial is the best tutorial for customization of UIElements like UInavigation bar, UIsegmented control, UITabBar. This … Read more

How to set the text of a back button on a UINavigationBar? [duplicate]

The setTitle way – though may seem to work, is incorrect. If you pay attention closely, you will notice that the navigation item changes to the new title while the new view is animated into view via pushViewController. The fact that you have to restore your title in viewWillAppear is kludgy, which further suggests its … Read more