Navigation Bar title font problem on ios 13

前端 未结 2 743
陌清茗
陌清茗 2021-01-25 17:05

I’m using Xcode 11.4 and iOS 13.4. I have set navigation bar title custom font using UINavigatinBar.appearance() And it works correctly but on iOS 13+ when i try to push to anot

2条回答
  •  Happy的楠姐
    2021-01-25 17:53

    Here you go, manage it in viewDidAppear:

    let lblTitle = UILabel()
    
    let titleAttribute: [NSAttributedString.Key: Any] = [.font: UIFont.boldSystemFont(ofSize: 21),
                                                    .foregroundColor: UIColor.black]
    
    let attributeString = NSMutableAttributedString(string: "Navigation Title", attributes: titleAttribute)
    
    lblTitle.attributedText = attributeString
    
    lblTitle.sizeToFit()
    navigationItem.titleView = lblTitle
    

提交回复
热议问题