. , , pre-iOS7, iOS7 editAccessoryView UITableViewCell, UIButton.
NIB, . :
if (([[[UIDevice currentDevice] systemVersion] compare:(@"7.0") options:NSNumericSearch] != NSOrderedAscending)) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(-4.0f, -3.0f, 48.0f, 48.0f);
self.editingAccessoryView = button;
[self.editingAccessoryView setHidden:YES];
}
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(-4.0f, -3.0f, 48.0f, 48.0f)];
button.tag=kCellButtonViewTag;
button.adjustsImageWhenHighlighted=NO;
[button setImage:[UIImage imageNamed:@"uncheckedPriorityNone.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(toggleCheckedMode:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:button];
[button release];
The point here is that the action is still added for the custom UIButton, but on iOS7 another button is created with the same size set in editAccessoryView and hidden. That should do the trick.
Remember setEditing: YES in your UITableView.
source
share