IOS uitableview单元格选中背景

标签 ios uitableview background

我的 IOS 应用程序中有一个 UItableview,其中包含一些信息。我使用以下代码将选定的背景颜色更改为 clearcolor:

UIView *bgColorView = [[UIView alloc] init];
[bgColorView setBackgroundColor:[UIColor clearColor]];
[cell setSelectedBackgroundView:bgColorView];
[bgColorView release];

单元格中有文本和 2 个图像,我使用 CGRectMake 构建了它。 但是当我选择并按住表格单元格时,图像会消失在看起来像白色背景的后面。

enter image description here

如您所见,我拿着“Dacnusa sibrica”细胞,我该如何解决这个问题?

最佳答案

如果你想禁用单元格的蓝色选择你也可以设置单元格的选择模式而不是修改背景:

cell.selectionStyle = UITableViewCellSelectionStyleNone

这只是在点击单元格时禁用蓝色选择,但仍允许选择单元格(并因此由代码处理)。

关于IOS uitableview单元格选中背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8429164/

相关文章:

ios - 如何获取 'react-native-cli' 以在指定硬件中运行我的应用程序?

c# - MonoTouch - 检测 UITableView 滚动

ios - 为什么从自定义单元调用时 UIkeyboard 没有动画?

ios - 错误 : "unable to dequeue a cell with identifier Cell"

javascript - Jquery 背景图像淡出

css - 如何在一个css文件中为不同的页面设置不同的正文背景颜色?

ios - 使用 SwiftForms 将值从 Rest API 传递到表单

iOS7 - 如何给 UITextField 添加下划线

iphone - Testflight SDK 缺失报告

android - 如何设置一个空的 ListView 的背景图片?