ios - Is there any way to change "DELETE" button from UITableViewCell? -
i want change delete button in uitableviewcell. actually, need :
- change position of button
- font
- text color of button.
here can change button text in following delegate method :
- (nsarray<uitableviewrowaction *> *)tableview:(uitableview *)tableview editactionsforrowatindexpath:(nsindexpath *)indexpath { uitableviewrowaction *viewaction = [uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault title:@"follow" handler:^(uitableviewrowaction *action, nsindexpath *indexpath) { nslog(@"view action fired"); }]; viewaction.backgroundcolor = [uicolor clearcolor]; return @[callaction]; }
but how change other attributes of button. if knows, please let me know.
thanks.
to working, implement following 2 methods on uitableview's delegate desired effect
- (bool)tableview:(uitableview *)tableview caneditrowatindexpath:(nsindexpath *)indexpath { return yes; } - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { // need implement method esle nothing work: }
check method created name of uitableviewrowaction *viewaction returned teh value of callaction modify once , try
- (nsarray<uitableviewrowaction *> *)tableview:(uitableview *)tableview editactionsforrowatindexpath:(nsindexpath *)indexpath { uitableviewrowaction *callaction = [uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault title:@"follow" handler:^(uitableviewrowaction *action, nsindexpath *indexpath) { nslog(@"view action fired"); }]; callaction.backgroundcolor = [uicolor clearcolor]; return @[callaction]; }
in standard uitableviewrowaction
can't change , can change
style
title
backgroundcolor
backgroundeffect
for more information see apple documents
Comments
Post a Comment