Posts

Showing posts with the label accessoryview

Changing the accessory view icon

Changing the stupid accessory icon is small exercise if you know precisely the right steps. Create the icon and change the accessory view to the icon view UIButton* pencil = [UIButton buttonWithType:UIButtonTypeCustom]; [pencil setImage:[UIImage imageNamed:@"icon-pencil.gif"] forState:UIControlStateNormal]; pencil.frame = CGRectMake(0, 0, 15, 15); pencil.userInteractionEnabled = YES; [pencil addTarget:self action:@selector(didTapEditButton:) forControlEvents:UIControlEventTouchDown]; cell.accessoryView = pencil; Code from: http://osmorphis.blogspot.com/2009/07/changing-accessory-view.html as a custom controller has been called it need to know the IndexPath. For that use: - (void)checkButtonTapped:(id)sender event:(id)event { NSSet *touches = [event allTouches]; UITouch *touch = [touches anyObject]; CGPoint currentTouchPosition = [touch locationInView:self.tableView]; NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition]; if (indexPath != nil) ...