如何在Ios中更改点击时表格单元格的不透明度
我想在点击时更改表格单元格的不透明度,并在释放点击时保留其不透明度。我已设置“选择样式”属性“无”。我不理解您的问题。但如果要更改单元格背景颜色和不透明度,则必须设置alpha如何在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
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;
}
介意解释一下你的解决方案吗?介意解释一下你的解决方案吗?介意解释一下你的解决方案吗?介意解释一下你的解决方案吗?