我正在用 Swift 撰寫我的應用程式。這是viewDidLoad()函式:
override func viewDidLoad() {
super.viewDidLoad()
if !self.check_file() {
print("Missing file to read")
performSegueWithIdentifier("missingfileViewController", sender: nil)
}
}
這是check_file()功能:
func check_file() -> Bool {
let fileManager = FileManager.default
return fileManager.fileExists(atPath:"/Applications/Readfile.app/Contents/Resources/textfile/readthis.txt")
}
我收到此錯誤Cannot find 'performSegueWithIdentifier' in scope。誰能幫我這個?非常感謝
編輯:我什至嘗試使用self.performSegueWithIdentifier,但出現了另一個錯誤:Value of type 'ViewController' has no member 'performSegueWithIdentifier'
uj5u.com熱心網友回復:
self.performSegue(withIdentifier: "missingfileViewController", sender: self)
試試這個
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/390824.html
標籤:迅速
