Reputation: 65439
Yeah yeah, I know... One should not (want to) replace the default buttons used in the UITableView because users recognize the buttons and know what to do with them.
However, the red minus sign and the green plus button look terrible with my custom made beautiful design and I would really like to find a way to add the designers images to these buttons (which are still very recognizable).
So the question would be how to replace those images ?
One way would be to not use the standard UITableView editing mode and build everything myself (as suggested on other questions on stackoverflow) but I hope I don't have to go all that way.
Another way is to build a whole new state in willTransitionToState
but I rather find an easier way.
If anyone has any suggestions please let me know!
I'm not looking for the editingAccessoryView
that one will place the accessoryView on the right..
Upvotes: 0
Views: 1266
Reputation: 65439
I myself found an answer to this problem!
I searched with the debugger and `po [self recursiveDescription] in the view hierarchy till I found the view responsible for the icons and replaced it with my own image
I made a github repo as an example but this is the code hiding the old image:
- (void) removeOriginalEditControl{
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) {
for (UIView *subsubview in subview.subviews) {
if ([NSStringFromClass([subsubview class]) isEqualToString:@"UIImageView"]) {
[subsubview removeFromSuperview];
break;
}
}
}
}
}
And later on I add a new UIImageView in place to show my new icon!
Check out the full example at: https://github.com/tiemevanveen/TableViewCustomEditControls
Upvotes: 1