Custom Navigation bar with bar attributes || Change navigationBar color swift || iOS NavigationBar color not changed || Backbutton position change in UINavigationBar iOS
Solution:
Here we can change the entire app navigation bar titlecolor,font and fontSize in swift.The code as follows.You can add the code in the appdelegate and get the custom navigation Bar.Also you can change the backButton position in the navigationBar
let style = NSMutableParagraphStyle()
style.lineBreakMode = .byTruncatingHead
let attrs = [NSParagraphStyleAttributeName: style,NSForegroundColorAttributeName:UIColor.white,NSFontAttributeName:UIFont(name: "Trebuchet MS", size: 20)]
UINavigationBar.appearance().titleTextAttributes = attrs
UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(-200, -5), for: .default)
UINavigationBar.appearance().tintColor = UIColor.white
Here we can change the entire app navigation bar titlecolor,font and fontSize in swift.The code as follows.You can add the code in the appdelegate and get the custom navigation Bar.Also you can change the backButton position in the navigationBar
let style = NSMutableParagraphStyle()
style.lineBreakMode = .byTruncatingHead
let attrs = [NSParagraphStyleAttributeName: style,NSForegroundColorAttributeName:UIColor.white,NSFontAttributeName:UIFont(name: "Trebuchet MS", size: 20)]
UINavigationBar.appearance().titleTextAttributes = attrs
UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(-200, -5), for: .default)
UINavigationBar.appearance().tintColor = UIColor.white
Comments
Post a Comment