NSFontAttributeName has changed to String

前端 未结 3 1603
走了就别回头了
走了就别回头了 2020-12-13 13:05

i\'m trying to style the navigation bar properly, i need to change the font to helvetica neue with a size point of 19. I\'ve ever used this code but i\'ve notice that now do

3条回答
  •  我在风中等你
    2020-12-13 13:49

    Swift 4.2

    NSAttributedStringKey has renamed to NSAttributedString.Key in Swift 4.2

    if let fontStyle = UIFont(name: "HelveticaNeue-Light", size: 19) {
      navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.font: fontStyle]
    }
    

提交回复
热议问题