무슨 일이 일어나고 있는지 혼란 스러워요. 프로그래밍에 익숙하지 않아서 콜렉션 뷰에 관한 튜토리얼을하고 있어요. 나는 모든 것을 올바르게하고 있다고 믿지만, 맞았습니다. -[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance
. http://www.thorntech.com/2015/08/want-your-swift-app-to-scroll-in-two-directions-like-netflix-heres-how/UITableView 인식 할 수없는 셀렉터를 인스턴스로 보냄
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
가장 환영 형제 –