Есть ли способ удалить разделительную линию из одной ячейки в UITableView?

Я обнаружил, что файл Program.cs не был частью решения. Я добавил добавление существующего элемента и добавил файл (Program.cs) обратно в решение.

Это исправило ошибку: Ошибка 1 Программа «.....» не содержит статического метода «Главная» подходит для точки входа

13
задан Mike McMaster 31 July 2009 в 15:28
поделиться

2 ответа

Лучше всего, вероятно, установить separatorStyle таблицы в UITableViewCellSeparatorStyleNone и вручную добавить / нарисовать линию (возможно, в tableView: cellForRowAtIndexPath: это.

17
ответ дан 1 December 2019 в 18:55
поделиться

Следуя совету Майка, вот что я сделал.

In tableView:cellForRowAtIndexPath:

...
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

    // Drawing our own separatorLine here because I need to turn it off for the
    // last row. I can only do that on the tableView and on on specific cells.
    // The y position below has to be 1 less than the cell height to keep it from
    // disappearing when the tableView is scrolled.
    UIImageView *separatorLine = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, cell.frame.size.height - 1.0f, cell.frame.size.width, 1.0f)];
    separatorLine.image = [[UIImage imageNamed:@"grayDot"] stretchableImageWithLeftCapWidth:1 topCapHeight:0];
    separatorLine.tag = 4;

    [cell.contentView addSubview:separatorLine];

    [separatorLine release];
}

// Setup default cell setttings.
...
UIImageView *separatorLine = (UIImageView *)[cell viewWithTag:4];
separatorLine.hidden = NO;
...
// In the cell I want to hide the line, I just hide it.
seperatorLine.hidden = YES;
...

In viewDidLoad:

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
9
ответ дан 1 December 2019 в 18:55
поделиться
Другие вопросы по тегам:

Похожие вопросы: