다른 유형의 표 셀을 포함하는 tableview를 만들려고하고 있는데 막혔습니다. (jQuery과 *)있는 tableView cellForRowAtIndexPath : (NSIndexPath *) indexPath { 나는 ...다른 셀 유형으로 구성된 tableview를 만드는 방법을 아는 사람이 있습니까?
- (있는 UITableViewCell *)있는 tableView의 행의 수에 따라 세포의 다른 유형을 반환하려면 어떻게
기능.
다른 유형의 표 셀을 포함하는 tableview를 만들려고하고 있는데 막혔습니다. (jQuery과 *)있는 tableView cellForRowAtIndexPath : (NSIndexPath *) indexPath { 나는 ...다른 셀 유형으로 구성된 tableview를 만드는 방법을 아는 사람이 있습니까?
기능.
당신이 해 모든이 할 당신의 nsindexpath의 행 또는 섹션에 스위치와 해당 jQuery과 셀을 반환은 ... 유 행 1
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
if(indexPath.row==0)
{
cell=..//tableviewcellA
}
if(indexPath.row==1)
cel=///tableviewcell b
}
에 대한 행 공 및 기타에 대한 TableViewCellA 및 TableViewCellB 하나가 말할 수 등등이 도움이되기를 바랍니다.
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *[email protected]"MyCell";
if (indexpath.section==0)
{
customCell1 *cell1=(customCell1 *)[tableView dequeueReusableCellWithIdentifier:identifier];
if (cell1==nil)
{
NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"customCell1" owner:self options:nil];
cell1=[nib objectAtIndex:0];
}
return cell1;
}
if (indexpath.section==1)
{
customCell2 *cell2=(customCell2 *)[tableView dequeueReusableCellWithIdentifier:identifier];
if (cell2==nil)
{
NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"customCell2" owner:self options:nil];
cell2=[nib objectAtIndex:0];
}
return cell2;
}
감사합니다. 나는 하루 동안 막 다른 골목에 빠져 있었고 이것이 모두 해결책이었습니다. 감사. – Matt