如何设置导航栏标题的字体大小

mcf*_*oft 4 font-size uinavigationbar ios swift

我尝试设置导航标题和其他项目的fontsize.我怎样才能做到这一点 ?

我们可以使用uinavigationbar.setTitleTextAttributes方法设置此方法,但是这个方法不存在(不再存在)

有人知道该怎么办吗?

navigationBar = UINavigationBar(frame: CGRectMake(0, 0, fDialogWidth, navbarHeigth))
        let navigationItem = UINavigationItem()
        navigationItem.title = sTitle;
        // Create left and right button for navigation item
        let leftButton = UIBarButtonItem(title: sBacklabel, style: UIBarButtonItemStyle.Plain, target: self, action: "backAction:")
        let rightButton = UIBarButtonItem(title: saddBookmark, style: UIBarButtonItemStyle.Plain, target: self, action: "addBookmarkAction:")



        // Create two buttons for the navigation item
        navigationItem.leftBarButtonItem = leftButton
        navigationItem.rightBarButtonItem = rightButton
        navigationBar.items = [navigationItem];

        navigationBar.frame = CGRectMake(0, 0, screenwidth, navbarHeigth);
Run Code Online (Sandbox Code Playgroud)

NSN*_*oob 12

将这些行添加到您的viewDidLoad()方法:

self.navigationController?.navigationBar.topItem?.title = "Your title" 
self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "Your Font", size: 34)!, NSForegroundColorAttributeName: UIColor.whiteColor()]
Run Code Online (Sandbox Code Playgroud)