导航控制器错误

时间:2014-12-07 05:36:52

标签: swift fonts uinavigationcontroller xcode6 uinavigationbar

我有一个导航控制器,我希望标题有自定义字体。我试过这样做但是当它运行时我得到线程1:EXC_BAD_INSTRUCTION(代码= EXC_1386_INVOP.subcode = 0x0)

这是我的代码。

import UIKit

class PriceCheckSpreadsheetViewController: UIViewController {

@IBOutlet weak var SpreadsheetView: UIWebView!

@IBOutlet weak var Loading: UIActivityIndicatorView!

@IBOutlet weak var BackButton: UIBarButtonItem!

@IBOutlet weak var ForwardButton: UIBarButtonItem!

@IBOutlet weak var NaviBar: UINavigationItem!

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.

    let url = "http://www.backpack.tf/pricelist/spreadsheet"
    let requestURL = NSURL(string: url)
    let request = NSURLRequest(URL: requestURL!)
    SpreadsheetView.loadRequest(request)


    self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "TF2Build", size: 12)!]
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func webViewDidStartLoad(_ : UIWebView) {
    Loading.startAnimating()
    NSLog("Loading")
}

func webViewDidFinishLoad(_ : UIWebView) {
    Loading.stopAnimating()
    NSLog("Done")

    if SpreadsheetView.canGoBack {
        BackButton.enabled = true
    }
    else {
        BackButton.enabled = false
    }

    if SpreadsheetView.canGoForward {
        ForwardButton.enabled = true
    }
    else {
        ForwardButton.enabled = false
    }
}

@IBAction func Reload(sender: AnyObject) {
    SpreadsheetView.reload()
}

@IBAction func Back(sender: AnyObject) {
    SpreadsheetView.goBack()
}

@IBAction func Forward(sender: AnyObject) {
    SpreadsheetView.goForward()
}


}

0 个答案:

没有答案