2017-03-07 93 views
0

我有這樣的代碼,而從舊版本的雨燕O版本3轉換...斯威夫特3選擇使用

func ownCatalogBackButton() { 
    // ... 
} 

而在同一類的其他地方我有

outletScoresDetailsNav.leftBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.ownCatalogBackButton(_:))); 

,但我得到的錯誤類型的

值 'ViewControllerScoresDetails' 沒有構件 ownCatalogBackButton

以防萬一,我誤解了功能選擇語法沒有我也試過任何參數:

outletScoresDetailsNav.leftBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.ownCatalogBackButton())); 

outletScoresDetailsNav.leftBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.ownCatalogBackButton(:))); 

outletScoresDetailsNav.leftBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.ownCatalogBackButton(_))); 

我的大腦必須固定在轉換時第1500個問題後炒,有什麼能這個錯誤的原因?

回答

0

嘗試這樣的:

outletScoresDetailsNav.leftBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.ownCatalogBackButton));