アプリ制作初心者です。
皆様のお力添えお願いできますでしょうか?
現在動画を参照しながらメモ帳アプリを制作中なのですが、エラーが出て先に進めません。
↓の動画の通りに入力しているのですが、動画で使われているSwiftのバージョンが古い事から来るエラーなのはわかっているのですが、
どう対処していいかわかりません。。
override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
self.view.endEditing(true)
この行でエラーが出るのですが、どう対処していいかわからず作業が止まっています。
Method does not override any method from its superclass
###該当のソースコード
●FirstViewController import UIKit class FirstViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{ return taskMgr.tasks.count } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "test") cell.textLabel?.text = taskMgr.tasks[indexPath.row].name cell.detailTextLabel?.text = taskMgr.tasks[indexPath.row].desc return cell } } ●SecoundViewController import UIKit class SecondViewController: UIViewController, UITextFieldDelegate{ override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) { self.view.endEditing(true) } //UITextField Delegate func textFieldShouldReturn(textField: UITextField) -> Bool{ textField.resignFirstResponder(); return true } }
###試したこと
バージョンにより引数の型に変更があるようなので、?をつけたりしてみたのですが、変化は見られませんでした。。
###補足情報(言語/FW/ツール等のバージョンなど)
Mac OS:10.11.4
Xcode:7.3
Swift
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/10 10:51