turn from: http://www.cnblogs.com/Coder-DJ/p/5645392.html
-(void) layoutsubviews
{
[Super Layoutsubviews];
For (UIView *subview in Self.subviews)
{
if ([Subview iskindofclass:nsclassfromstring (@ "Uitableviewcelldeleteconfirmationview")])
{
UIView *confirmview= (UIView *) [subview.subviews firstobject];
Change background color
Confirmview.backgroundcolor=[uicolor colorwithwhite:0.898 alpha:1.000];
For (UIView *sub in Confirmview.subviews)
{
Modify the size and color of the word to modify the text style
/*
if ([Sub Iskindofclass:nsclassfromstring (@ "Uibuttonlabel")]) {
Uilabel *deletelabel= (Uilabel *) Sub;
Deletelabel.backgroundcolor = [Uicolor Redcolor];
Change the font size of the delete button
Deletelabel.font=[uifont BOLDSYSTEMFONTOFSIZE:20];
Change the text of a button
deletelabel.text=@ "hehe";
}
*/
Add a picture
if ([Sub Iskindofclass:nsclassfromstring (@ "UIView")]) {
UIView *deleteview = Sub;
Uiimageview *imageview = [[Uiimageview alloc] init];
Imageview.image = [UIImage imagenamed:@ "Iconfont-zhuchang"];
Imageview.frame = CGRectMake (Cgrectgetmaxx (sub.frame)-58,-5, 30, 30);
[Deleteview Addsubview:imageview];
}
}
Break
}
}
}
So you can successfully modify the Delete button of the red background color into a custom picture.
But careful little partner will find that every time you click on the button button will appear a short white delete text, do not be afraid, let us rewrite a method is good:
#pragma mark Change Delete button text (make text blank)
-(nsstring*) TableView: (uitableview*) TableView Titlefordeleteconfirmationbuttonforrowatindexpath: (NSIndexPath*) Indexpath {
return @ "";
}
That's the solution.
Sometimes there is also a requirement for sideslip to display two options, which is also very simple, in-(Nsarray *) TableView: (UITableView *) TableView Editactionsforrowatindexpath: ( Nsindexpath *) Indexpath method to add uitableviewrowaction on the line, the specific people to grope themselves out.