내가 RubyMotion에 새로운 해요 반환하지 않습니다. 나는 다음과 같은 오류 메시지가 실행 해요RubyMotion jQuery과 데이터 소스는 제대로
class LectureController < UIViewController
def viewDidLoad
super
self.view.backgroundColor = UIColor.whiteColor
@lectures ||= []
Lecture.get() do |success, lectures|
if success
@lectures = lectures
p "Received #{@lectures.length} lectures"
@table.reloadData
else
App.alert("OOPS!")
end
end
@table = UITableView.alloc.initWithFrame(self.view.bounds)
self.view.addSubview @table
@table.dataSource = self
def tableView(tableView, numberOfRowsInSection: section)
@lectures.count
end
def tableView(tableView, cellForRowAtIndexPath: indexPath)
@reuseIdentifier ||= "CELL_IDENTIFIER"
cell = tableView.dequeueReusableCellWithIdentifier(@reuseIdentifier) || begin
UITableViewCell.alloc.initWithStyle(UITableViewCellStyleDefault, reuseIdentifier: @reuseIdentifier)
end
cell.textLabel.text = @lectures[indexPath.row].name
cell
end
end
def initWithNibName(name, bundle: bundle)
super
self.title = "Lectures"
self
end
end
:이 컨트롤러로
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'UITableView dataSource must return a cell from
tableView:cellForRowAtIndexPath:'
는 최대한 멀리 볼 수있는,
cellForRowAtIndexPath
는
셀을 반환을해야합니다. 나는 왜 그것이 작동하지 않을지를 알 수 없다.
도움을 주시면 감사하겠습니다.
그것은 cellForRowAtIndexPath 내에서 길잃은 "끝"이 될 수 있을까요? – Stavash
아니, 그건'cell = tableView.dequeueReusableCellWithIdentifier (@reuseIdentifier)의 일부입니다. || – Ammar