繁体   English   中英

iPhone SDK - 在 TableView 中突出显示选定的单元格

[英]iPhone SDK - Highlight the selected cell in TableView

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

cell.selectionStyle = UITableViewCellSelectionStyleBlue;

但是,tableView 如下图所示。

在此处输入图像描述

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

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

这会很好用

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

[_tableView deselectRowAtIndexPath:selectedIndexPath animated:YES];

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

NSIndexPath *selectedIndexPath;

也把这个 to.h 文件

尝试这个

UIView *viewSelected = [[[UIView alloc] init] autorelease];
    viewSelected.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"cell_highlighted.PNG"]];
    cell.selectedBackgroundView = viewSelected;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM