2014-02-19 5 views
0

Rubymotion 앱을 개발 중입니다. 이 응용 프로그램에서 나는 10 행 tableview 있어요. 이 행을 created_at으로 그룹화하고 섹션 제목에 그룹화 된 각 날짜를 표시합니다.모든 섹션이 각 섹션 아래에 반복됩니다.

이 제목을 표시해도 문제가 없지만 각 섹션 제목 아래에 10 개의 행이 모두 나타나서 30 행 (3 섹션)이됩니다. 즉, 모든 섹션에 10 개의 행이 모두 표시됩니다. 뭐가 잘못 되었 니? 당신이 그 부분에 대한 작업의 실제 수를 반환하는 모든 작업이 아닌 수 있어야합니다

def numberOfSectionsInTableView(tableView) 

    @tasks.length 

    end 

    def tableView(tableView, numberOfRowsInSection:section) 

    @tasks.length 

    end 

    def tableView(tableView, titleForHeaderInSection:section) 

    @tasks[section]['start_date'] 

    end 

답변

3

tableView(tableView, numberOfRowsInSection:section)에서 :

이들은

내 대표입니다. 그래서 @tasks[section].length.