This is just a UIView regarding Apple Documentation . So just define it as a UIView.
First you need to create your own subclass of UITableViewCell (in this case it is called MyCell). In this class, define the frame of your AccessoryView in the layoutSubviews method.
- (void)layoutSubviews { [super layoutSubviews]; self.accessoryView.frame = CGRectMake(0, 0, 20, 20); }
In your view controller, tell the table to use this class as a cell. In addition, you must set the accessView to a UIImageView containing your image.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[MyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"check.png"]] autorelease]; }
When the user clicks on a cell, you can simply change the image of the table table accessory.
source share