2016-05-23 120 views
0

全部如何从tableview行单元格中删除单独的行?

如何从UITableView单元行中删除单独的行。 我尝试了它,但仍然在UITableViewCell行中绘制了单独的一行。

- (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.selectionStyle = UITableViewCellSeparatorStyleNone; 
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
    } 
    cell.selectionStyle = UITableViewCellSelectionStyleNone; 
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
    cell.backgroundColor = [UIColor colorWithRed:217.0/255.0 green:235.0/255.0 blue:244.0/255.0 alpha:1.0]; 
    cell.textLabel.text = LOREM; 
    [cell.textLabel setFont:[UIFont fontWithName:@"GillSans" size:12.0]]; 
    cell.textLabel.numberOfLines = 0; 
    return cell; 
} 

错误图片: - enter image description here

+0

http://stackoverflow.com/questions/8561774/hide-separator-line-on-one-uitableviewcell –

+0

的可能的复制你为什么要在每个设置TableView中财产细胞创造? –

回答

1

尝试,把self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;到您viewDidLoad...,而不是cellForRow... ...

+0

Slotta我尝试它,但仍然无法正常工作。我为这个类使用了UITableViewController。并在我的XIB中设置为非,但仍在每个单元中的绘图分隔线。 – kiran

0

用途:

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; 
1

Nib文件试试这个。选择您tableview,使SeparatorNone

enter image description here

相关问题