何が起きているのか混乱しています。私はプログラミングの初心者としてコレクションビューのチュートリアルを行っています。私はすべてを正しくやっていると信じていますが、ヒットします。-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance
。ここでUITableViewインスタンスに送信されたセレクタが認識されない
はチュートリアルです: http://www.thorntech.com/2015/08/want-your-swift-app-to-scroll-in-two-directions-like-netflix-heres-how/
import UIKit
class ViewController: UIViewController, UITableViewDataSource {
var categories = ["Action", "Drama", "Science Fiction", "Kids", "Horror"]
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return categories[section]
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return categories.count
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell") as! CategoryRow
return cell
}
これは機能しました。ありがとう私はviewcontrollerの代わりに直接tableviewに自分のデータソースを設定 – Hightower98
ほとんどの仲間の仲間 –