I've been having a problem of adding a checkbox image to my uitableviewcell and toggle between checked and unchecked image.
My simple code is:
-(UITableViewCell *)tableView:(UITableView *)todoTable cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [self.todoTable dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if (!cell) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease];
}
cell.textLabel.text = [self.todoList objectAtIndex:indexPath.row];
return cell;
}
and i try to add in the solution in from here
But i don't know where shall i put the
interface ToggleImageControl : UIControl
I assume i put it in the same header file as my viewcontroller?
also i try to put in
ToggleImageControl *toggleControl = [[ToggleImageControl alloc] initWithFrame: <frame>];
toggleControl.tag = indexPath.row; // for reference in notifications.
[cell.contentView addSubview: toggleControl];
into my code above, i will get a ToggleImageControl
reference error because of the implementation of the interface is not found, how can i fix this?
Thanks.