Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 单击后可以看到的单元格上的文本_Ios_Objective C - Fatal编程技术网

Ios 单击后可以看到的单元格上的文本

Ios 单击后可以看到的单元格上的文本,ios,objective-c,Ios,Objective C,单击后可以看到的单元格上的文本 cellforrowatinexpath的代码 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"DrawConfirmCell"; UITableViewCell *cell = [tableView dequeueR

单击后可以看到的单元格上的文本

cellforrowatinexpath的代码

- (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;
}

若我并没有错,你们在点击单元格后并没有看到文本。 原因是您的文本颜色是灰色的,所以选定的单元格背景色

如果您想为任何操作选择单元格,则需要更改文本颜色

如果不想使选定内容可见,可以通过以下方法删除选定单元格的选定内容

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

更好地解释你的问题。你想做什么?你的问题是什么?您刚刚发布了代码。@zz2370092729,我想您在单击单元格后并没有看到标签。您可能没有,因为您选择了单元格。将以下代码放入表DIDSelectRowatinex方法并选中。[tableView取消行索引路径:indexPath动画:是];我分配给detailTextLabel.text的文本,但没有显示,必须单击单元格才能看到。添加:文本颜色和突出显示颜色不一样,因为我将文本设置为红色会发生我找到原因,将字体设置为cell.detailTextLabel,将model.fontSize设置为nil,这就是原因。