Я хочу, чтобы мой tableView показывал 6 строк с текстом в нем, в данном случае «Пример». Насколько я могу судить, у меня правильно установлены numberOfSectionsInTableView:
и numberOfRowsInSection:
. См. пример кода ниже:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
// Return the number of rows in the section.
return 6;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Example";
return cell;
}
Проблема заключается в том, что вы видите изображение ниже, показывающее линии для строк, которые не должны/не существуют.
Как мне избавиться от строк, показывающих последнюю строку 6?