0

I know this is very simple but I have looked everywhere and cannot find the answer to this. What I have found tells me to write this code, or similar code. And I have tried everything. I am using a Navigation Controller and I want to change the font and size of the text. I have not been able to change the font or size of text at all. Any help is very much appreciated!

    self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "Apple SD Gothic NEO", size: 20)!]
    self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
01Riv
  • 1,444
  • 1
  • 13
  • 28
  • check the answer here [http://stackoverflow.com/questions/26008536/navigationbar-bar-tint-and-title-text-color-in-ios-8](http://stackoverflow.com/questions/26008536/navigationbar-bar-tint-and-title-text-color-in-ios-8) – Ronak Chaniyara Feb 23 '16 at 07:12
  • Thanks but I've tried that. The color changes to orange with .orangeColor but when i use RGB values the text disappears – 01Riv Feb 23 '16 at 07:15
  • I figured out my issue with the RGB values but I still cannot change the font and size. – 01Riv Feb 23 '16 at 07:22
  • The link that Ronak sent to you, there has the solution. You have to make some change in the AppDelegate. – Dara Tith Feb 23 '16 at 07:26
  • I've read through that post and I don't think that relates to mine. I've changed the font, however I cannot change the size. – 01Riv Feb 23 '16 at 07:47

1 Answers1

0

A possible solution is replace the title label with a new one.

Example:

let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 20, height: 50))
titleLabel.text = "Title"
titleLabel.font = UIFont.boldSystemFontOfSize(17)

self.navigationItem.titleView = titleLabel
Gnurant
  • 446
  • 3
  • 9