셀 만들기 :IOS 테이블보기 : 표보기 사용자 정의 셀 그것은 스크롤하는 동안 다른 셀의 값을 미리 채 웁니다
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath{
AddEventsCell *cell=
[tableView dequeueReusableCellWithIdentifier:@"addevents"];
NSLog(@"cell %@",cell);
if(cell==nil){
[tableView registerNib:[UINib nibWithNibName:@"addevents"
bundle:nil]
forCellReuseIdentifier:@"addevents"];
cell=[tableView dequeueReusableCellWithIdentifier:@"addevents"];
}
cell.tag=indexPath.row;
return cell;
}
디스플레이 셀 :
-(void) tableView:(UITableView *)tableView
willDisplayCell:(AddEventsCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"index path %d == %d",indexPath.row,cell.tag);
if(cell.tag==0){
[email protected]"Event Name";
[email protected]"0";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==1){
[email protected]"Category";
[email protected]"1";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==2){
[email protected]"Upload Image";
[email protected]"2";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==3){
[email protected]"Time";
[email protected]"3";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==4){
[email protected]"Location";
[email protected]"4";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==5){
[email protected]"Description";
[email protected]"5";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==6){
[email protected]"Factilitator";
[email protected]"6";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==7){
[email protected]"Price";
[email protected]"7";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==8){
[email protected]"Notes";
[email protected]"8";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==9){
[email protected]"Duration";
[email protected]"9";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==10){
[email protected]"Program";
cell.textFi[email protected]"10";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==11){
[email protected]"pre-requiment";
[email protected]"11";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==12){
[email protected]"Target";
[email protected]"12";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==13){
[email protected]"Contact";
[email protected]"13";
[self.textfieldArray addObject:cell.textFieldValue];
}else if(cell.tag==14){
[email protected]"Website";
[email protected]"14";
[self.textfieldArray addObject:cell.textFieldValue];
}
}
모든 세포 개체를 추가됨 self.textfieldArray
첫 번째 bo x는 7 번째 상자에 같은 값을 표시한다는 의미입니다.
데이터의 미리 채우기를 중지합니다.
'labelFieldValue'에 대해'NSArray '를 만들 수 있으며 ** cell.lableFiledValue.text = [yourArray objectAtIndex : indexPath.row]; ** –