0
私はuitableviewを作成しました。起動すると、それは想定どおりに見えますが、スクロールすると、指定しない他のすべてのセクションにテキストが表示されます。助けてください。 添付されている最初のイメージは、どのように見えるかです。二番目はスクロールするときの動作です。スクロールするときにUITableViewセルのラベルが移動する
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0){
return 1;}
else if (section == 1){
return [cellLabels count];
}else if (section == 2){
return 1;
}else{
return 0;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"cellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
tableView.showsVerticalScrollIndicator = NO;
// cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
if(indexPath.section == 0)
{
}
else if (indexPath.section == 1)
{
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.textColor = [UIColor blackColor];
// headerLabel.font = [UIFont SystemFontOfSize:16];
[cell.textLabel setFont:[UIFont fontWithName:@"Arial" size:14]];
cell.textLabel.text = [cellLabels objectAtIndex:indexPath.row];
}
return cell;
}