cuappdev/ithaca-transit-ios

Update "Cancel" button size and font

Closed this issue · 0 comments

I'd do it myself, but I know you're working with what Google gives you. You might need to not show the button and make your own. The code below should help.

let otherAttributes = [NSFontAttributeName: UIFont(name :".SFUIText", size: 14)!]
let titleAttributes: [String : Any] = [NSFontAttributeName : UIFont(name :".SFUIText", size: 18)!,
                                               NSForegroundColorAttributeName : UIColor.black]
        
// general
title = "Route Details"
UIApplication.shared.statusBarStyle = .default
navigationController?.navigationBar.backgroundColor = .white
        
// text and font
navigationController?.navigationBar.tintColor = .primaryTextColor
navigationController?.navigationBar.titleTextAttributes = titleAttributes
navigationController?.navigationItem.backBarButtonItem?.setTitleTextAttributes(otherAttributes, for: .normal)
        
// right button
self.navigationItem.leftBarButtonItem?.setTitleTextAttributes(otherAttributes, for: .normal)
let cancelButton = UIBarButtonItem(title: "Exit", style: .plain, target: self, action: #selector(exitAction))
cancelButton.setTitleTextAttributes(otherAttributes, for: .normal)
self.navigationItem.setRightBarButton(cancelButton, animated: true)