2

我在 tableView 中有一个 customTableViewCell。我选择使用时突出显示单元格,

cell.selectionStyle = UITableViewCellSelectionStyleBlue;

但是,tableView 如下图所示。

在此处输入图像描述

它隐藏 customCell 中的标签和文本。我只想简单地突出显示单元格而不隐藏背景图像和标签。我不知道我在哪里犯了错误,无论是在代码中还是在 IB 中。.

4

4 回答 4

4
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.Your_imageView.highlightedImage = [UIImage imageNamed:@"Your_image_Name.png"];

这会很好用

于 2012-07-17T04:26:55.697 回答
2

嘿,我认为您需要将 customCell 中的标签和文本添加到cell.contentview。有关参考,请转到 Apple 开发人员文档。
http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7

于 2011-06-10T06:55:24.290 回答
0
[_tableView deselectRowAtIndexPath:selectedIndexPath animated:YES];

将其放入查看 Will Appear 及其对我的作品,

NSIndexPath *selectedIndexPath;

也把它放到 .h 文件中

于 2011-06-10T07:12:17.130 回答
0

试试这个

UIView *viewSelected = [[[UIView alloc] init] autorelease];
    viewSelected.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"cell_highlighted.PNG"]];
    cell.selectedBackgroundView = viewSelected;
于 2011-06-11T22:52:51.897 回答