我想隐藏在我的UITableView中的两个单元格下的灰线(分隔符),但是我遇到了麻烦。隐藏单个UITableViewCell分隔符
我有一个分组的UITableView,这是我的cellForRowAtIndexPath方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil];
if (indexPath.section == 0)
{
if (indexPath.row == 0) {
// Date
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Date:";
cell.detailTextLabel.text = currentDateString;
} else if (indexPath.row == 1) {
// UIPicker
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.clipsToBounds = YES;
[cell.contentView addSubview:datePickerForCell];
}
} else if (indexPath.section == 1) {
if (indexPath.row == 0) {
// Order No.
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Order No:";
cell.detailTextLabel.text = @"001-01989";
} else if (indexPath.row == 2) {
// Location
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Completed:";
CGFloat optionalRightMargin = 10.0;
CGFloat optionalBottomMargin = 10.0;
completedByTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, cell.contentView.frame.size.width - 110 - optionalRightMargin, cell.contentView.frame.size.height - 10 - optionalBottomMargin)];
self.completedByTextField.delegate = self;
completedByTextField.textColor = [UIColor grayColor];
completedByTextField.tag = 2;
completedByTextField.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
completedByTextField.textAlignment = NSTextAlignmentRight;
completedByTextField.placeholder = @"Name";
completedByTextField.text = completedByString;
[cell.contentView addSubview:completedByTextField];
} else if (indexPath.row == 3) {
// Hours Worked
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Hours Worked:";
cell.detailTextLabel.text = @"4 hrs 26 min";
}
} else if (indexPath.section == 2) {
if (indexPath.row == 0) {
// Description
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Description:";
} else if (indexPath.row == 1) {
// Description Textfield
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
[cell.contentView addSubview:descriptionTextView];
}
} else if (indexPath.section == 3) {
if (indexPath.row == 0) {
// Materials
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Materials:";
}
}
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
return cell;
}
我想隐藏在隔板中的
//说明文本字段细胞
和
// Materials Textfield Cell(这个还没有写完,它只是我想表明将会有两个单元我想要做这两个n不只是一个,因为它可能会影响你的答案,我猜...)
我已阅读关于使用tableview.separatorcolor,但这改变了TableView中每个单元格分隔符颜色的颜色。
它将表的所有隔板被反映视图.... – 2015-03-03 06:49:02