2015-07-10 23 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]; 
} 
相關問題