我确定这种方法不被支持,但它确实有效。关闭xcode,在文本编辑器(如vi)中打开.xib或.storyboard文件。找到您的表的XML并更改单元格颜色。例如,以下是默认白色表格单元格的原始部分:
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" indicatorStyle="black" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="k63-au-YAF">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
查找并更改颜色标记。下面是一个包含原始帖子颜色的示例:
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" indicatorStyle="black" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="k63-au-YAF">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1.0" green="0.95294117647059" blue="0.68627450980392" alpha="0.5" colorSpace="calibratedRGB"/>
<prototypes>
再次打开xcode,并且您的单元格颜色已更新。
注意:对于颜色代码,255分之243= 0.95294117647059(绿色),255分之175= 0.68627450980392(红色)等
的UITableViewCell没有backgroundColor属性....莫非是你的问题? – 2010-03-04 23:02:41
@Chip它呢,'backgroundColor'是从'UIView'继承的 – 2010-03-04 23:25:24
当然可以。抱歉。这是一个自定义的子类还是一个预定义的样式? – 2010-03-05 13:30:09