2016-04-11 85 views
0

我學習上的經驗教訓迅速和有這樣的項目:http://supereasyapps.com/blog/2014/12/15/create-an-ibdesignable-uiview-subclass-with-code-from-an-xib-file-in-xcode-6過渡與導航控制器

項目的結構 The structure of the project

基類 Base Class

所以它看起來模擬器 So it looks on an emulator

我想單擊按鈕「按我」並轉到另一個通過導航控制器查看(這裏是後退按鈕)像這樣(最好,如果它通常會在Main.storyboard上): enter image description here

它是真的嗎?任何解決方案? 項目在GitHub上:https://github.com/PaulSolt/CustomViewFromXib

回答

0

試試這個在視圖控制器

self.navigationItem.leftBarButtonItem.title = "Press Me" 

viewDidLoad方法,但我根據我的經驗建議你創建自己的後退按鈕和自己處理。

override func viewDidLoad() { 
    self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"Press Me", style:.Plain, target:nil, action:"backButtonPressed") 
} 

func backButtonPressed() 
{ 
    self.navigationController?.popViewControllerAnimated(true) 
}