Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.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_Uitableview - Fatal编程技术网

如何在Ios中更改点击时表格单元格的不透明度

如何在Ios中更改点击时表格单元格的不透明度,ios,uitableview,Ios,Uitableview,我想在点击时更改表格单元格的不透明度,并在释放点击时保留其不透明度。我已设置“选择样式”属性“无”。我不理解您的问题。但如果要更改单元格背景颜色和不透明度,则必须设置alpha cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.] 小区点击事件 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSInd

我想在点击时更改表格单元格的不透明度,并在释放点击时保留其不透明度。我已设置“选择样式”属性“无”。

我不理解您的问题。但如果要更改单元格背景颜色和不透明度,则必须设置alpha

cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.]
小区点击事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}

如果要在点击时更改单元格颜色,可以使用此方法

我不明白你的问题。但如果要更改单元格背景颜色和不透明度,则必须设置alpha

cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.]
小区点击事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}

如果要在点击时更改单元格颜色,可以使用此方法

我不明白你的问题。但如果要更改单元格背景颜色和不透明度,则必须设置alpha

cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.]
小区点击事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}

如果要在点击时更改单元格颜色,可以使用此方法

我不明白你的问题。但如果要更改单元格背景颜色和不透明度,则必须设置alpha

cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.]
小区点击事件

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}
如果要在点击时更改单元格颜色,可以使用此方法

使用以下命令:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];

    cell.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
    //Or use:
    cell.contentView.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
}
使用以下命令:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];

    cell.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
    //Or use:
    cell.contentView.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
}
使用以下命令:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];

    cell.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
    //Or use:
    cell.contentView.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
}
使用以下命令:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];

    cell.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
    //Or use:
    cell.contentView.backgroundColor = [UIColor colorWithRed:x green:y blue:z alpha:alphaValue];
}
使用以下命令:

//change opacity when select row
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 0.4;
    return indexPath;
}

//the opacity back when deselect row
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 1;
    return indexPath;
}
使用以下命令:

//change opacity when select row
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 0.4;
    return indexPath;
}

//the opacity back when deselect row
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 1;
    return indexPath;
}
使用以下命令:

//change opacity when select row
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 0.4;
    return indexPath;
}

//the opacity back when deselect row
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 1;
    return indexPath;
}
使用以下命令:

//change opacity when select row
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 0.4;
    return indexPath;
}

//the opacity back when deselect row
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.layer.opacity = 1;
    return indexPath;
}

介意解释一下你的解决方案吗?介意解释一下你的解决方案吗?介意解释一下你的解决方案吗?介意解释一下你的解决方案吗?