2015-07-10 22 views
-4

文本的单元之后将看到能够点击在单元格中的文本可以点击

代码的cellForRowAtIndexPath

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"DrawConfirmCell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; 
    if (cell ==nil) { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; 
     cell.textLabel.textColor = [UIColor darkTextColor]; 
     cell.detailTextLabel.textColor = [UIColor grayColor]; 
    } 


    Model *model = [_itemArray objectAtIndex:indexPath.row]; 
    cell.textLabel.text = model.sign; 
    cell.detailTextLabel.text = model.message; 
    [cell.detailTextLabel setFont:[UIFont systemFontOfSize:model.fontSize.intValue]]; 

    return cell; 
} 
+1

更好地解释你的问题。你想做什么? – Dharmik

+0

你的问题是什么?你刚刚发布了代码。 –

+0

@ zz2370092729,我想你在点击单元格后看不到标签。你可能不是因为你选择了细胞。把下面的代码放到你的表didSelectRowAtIndex方法中并检查。 [tableView deselectRowAtIndexPath:indexPath animated:YES]; – Dharmik

回答

1

后看到如果我没有错,点击单元格后,您没有看到文字。 原因是你的文字颜色是灰色的,所以选择了单元格背景色。

如果您希望能够选择单元格进行任何操作,则需要更改文字颜色。

如果您不想让选择可见,您可以通过以下方法删除选定单元格的选择。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
} 
相关问题