제목에서 말한 것처럼 두 섹션으로 된 테이블보기를 만들고 싶습니다. 첫 번째 초에는 텍스트 상자가있는 셀 하나가 포함됩니다. 두 번째 섹션은 배열 내용으로 동적으로 채워 져야합니다. 다중 테이블보기 섹션 : 정적 셀이있는 첫 번째 섹션과 동적 셀 번호가있는 두 번째 섹션
나는이 코드를 썼다 :- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 1)
{
static NSString *simpleTableIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
Player *player = [self.playerController getPlayerAtPositon:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@", player.persistentData.name];
return cell;
}
else
{
// ???
}
}
하지만이 else
코드 블록에 쓸 무엇을해야합니까? 그래서 내가 텍스트 상자로 채우는 셀은 덮어 쓰지 않을 것입니까?
필자는 요소를 동적으로 추가 할 수 없다는 것을 알았습니다. 예를 들어 3 명의 플레이어를 추가하려면 행 값을 3으로 설정해야합니다. 그렇지 않으면 앱이 중단됩니다. 이 작업을 동적으로 수행 할 수있는 방법이 있습니까?
당신을 도움이 될 것입니다 세포? – Pascal
텍스트 필드가있는 셀에 하나의 식별자를 사용하고 다른 유사한 셀에 다른 식별자를 사용하십시오. – Yogendra