【发布时间】:2013-03-11 06:12:11
【问题描述】:
我有一个UITableViewController,我在这些单元格中添加了一个UIImageView。这个UIImageView 在一个自定义的 TableViewCell 中。所以我的问题是当我使用didSelectRowAtIndexPathdelegate 方法选择行时如何更改此图像。我试过了,它在 tableviewcell 上显示图像,但单击此图像后没有改变。如何解决?
这是我的代码 -
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:
(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
MantrasListCell *customCell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (customCell == nil)
{
customCell = [[MantrasListCell
alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
customCell.imgView.image = [UIImage imageNamed:@"play.png"];
return customCell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MantrasListCell *customCell = (MantrasListCell*)[tableView
cellForRowAtIndexPath:indexPath];
customCell.imgView.image = [UIImage imageNamed:@"pause.png"];
}
【问题讨论】:
-
请解释问题.!!
-
好....最后你填补了这些点...现在这看起来像一个问题。
标签: iphone uitableview customization