많은 검색을 해왔지만 여러 사용자 정의 행과 관련된 유용한 것을 찾지 못했습니다. x30 파일에서 행을로드해야하는 내 앱의 설정 tableView를 만들어야합니다.여러 사용자 정의 행 UITableView?
ROW 1 = 1 >> XIB
ROW 2 = 2 >> XIB
ROW 3 = 3 >> XIB
ROW 4 = 4 >> XIB
내 본 번호 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell=nil;
//We use CellType1 xib for certain rows
if(indexPath.row==0){
static NSString *CellIdentifier = @"ACell";
cell =(ACell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil){
NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"ACell" owner:self options:nil];
cell = (ACell *)[nib objectAtIndex:0];
}
//Custom cell with whatever
//[cell.customLabelA setText:@"myText"]
}
//We use CellType2 xib for other rows
else{
static NSString *CellIdentifier = @"BCell";
cell =(BCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil){
NSArray *nib= [[NSBundle mainBundle] loadNibNamed:@"BCell" owner:self options:nil];
cell = (BCell *)[nib objectAtIndex:0];
}
//Custom cell with whatever
//[cell.customLabelB setText:@"myText"]
}
return cell;
}
"<원하는 것은 무엇이든>"무엇을 의미합니까? – Mateus
여러 개의 Xib을 사용하고 싶습니다. x1을 x1으로, xib2를 n2 등으로 추측하고 있습니다. 따라서 if/else 문은 행을 검사합니다 색인 및 달성하고자하는 것을 기준으로 올바른 행 색인 –
에서 올바른 xib을 선택하십시오. 내 XIB의 기본보기는 UITableViewCells에 대해 변경해야합니까? 아니면보기의 크기를 조정해야합니까? – Mateus