2 섹션으로 하나의 tableview을 만들었고 tableview ..에있는 데이터의 배열을 표시했습니다. 이제 섹션을 확장하고 축소하려고합니다 ... 저는 초급자입니다. 이것은 내 cellForRowAtIndexPath 및 arraytable입니다확장 및 iOS에서 tableview에 대한 방법을 축소
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arraytable count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellitem = @"simpletableitem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellitem];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellitem];
}
cell.textLabel.text = [arraytable objectAtIndex:[indexPath row]];
return cell;
}
의 tableview 섹션을 확장 및 축소에 대한 샘플 코드는 ... 내가 한 부하 여기
arraytable = @[@"hari12",@"narayanan",@"Praba",@"Deepak",@"Sailesh",@"Ram charan"];
제발 간단한 설명을 해주세요. 제게 많은 복잡한 웹 사이트를 검색했습니다. –
제 머리 꼭대기에서'tableView : numberOfRowsInSection :'을 수정하여'arraytable.count '(확장) 또는 '0'(접힌 상태)으로 표시됩니다. 그래도 더 나은 방법이 될 수 있습니다 ... – AMI289
나는 그것을 시도해 주셔서 감사합니다 ... –