2010-06-01 6 views
0

테이블 뷰의 다른 섹션에서 행 구성을 다르게 할 수 있습니까?테이블 뷰의 다른 섹션에 행 구성을 다르게 할 수 있습니까?

-(UITableViewCell *)tableView:(UITableView *)tableView 
    cellForRowAtIndexPath:(NSIndexPath *)indexPath 

그래서 같은 테이블보기에서 다른 부분에 대해 다르게 할 수 있습니다 :

이 방법은 부분 매개 변수를 포함하지 않는 이유는 무엇입니까?

답변

1

예 서로 다른 시야로 구성 할 수 있습니다.

사실 indexPath.row는 행 인덱스를 제공하고 indexPath.section은 섹션 인덱스를 제공합니다.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSLog(@"You are at row = %d and section = %d",indexPath.row,indexPath.section); 
} 

두 개의 색인으로 나누어서 다른 구성을 지정할 수 있습니다.

짐.

관련 문제