Для моего приложения я создал пользовательскую ячейку, а затем добавил imageView в contentView
Но для вашего требования вы можете сделать что-то вроде этого
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
cell.accessoryView = imageView];
imageView.tag = 3;
[imageView release];
}
NSArray *subviews = [[NSArray alloc] initWithArray:cell.contentView.subviews];
UIImageView *imageView;
for (UIView *subview in subviews)
{
if([subview isKindOfClass:[UIImageView class]] && subview.tag == 3);
imageView = [subview copy];
}
[subviews release];
if([selectedArray containsObject:indexPath])
imageView.image = [UIImage imageNamed:@"Selected.png"];
else
imageView.image = [UIImage imageNamed:@"Unselected.png"];
}
И в этом методе сделатьто же самое, чтобы получить объект imageView
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath