2016-05-23 92 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

相關問題