ios - UITableViewRowAction change backgroundcolor on press -
i created instance of uitableviewrowaction
in
-(nsarray *)tableview:(uitableview *)tableview editactionsforrowatindexpath:(nsindexpath *)indexpath
and have handler block when row action triggered:
handler:^(uitableviewrowaction *action, nsindexpath *indexpath)
you have row action parameter can used not create retain cycles , have index path. i've tried setting backgroundcolor
of new row action this:
[action setbackgroundcolor:[uicolor greencolor]];
but did not change anything. tried setneedsdisplay
on button object of row action, without luck.
any idea how can change backgroundcolor
while row actions still visible? thanks
- xcoder
here implementation of same , works well. should solve problem well..
- (nsarray *)tableview:(uitableview *)tableview editactionsforrowatindexpath:(nsindexpath *)indexpath { uitableviewrowaction *one = [uitableviewrowaction rowactionwithstyle:0 title:@"one" handler:^(uitableviewrowaction *action, nsindexpath *indexpath) { nslog(@"my first action"); }]; uitableviewrowaction *two = [uitableviewrowaction rowactionwithstyle:1 title:@"two" handler:^(uitableviewrowaction *action, nsindexpath *indexpath) { nslog(@"my second action"); }]; uitableviewrowaction *three = [uitableviewrowaction rowactionwithstyle:1 title:@"three" handler:^(uitableviewrowaction *action, nsindexpath *indexpath) { nslog(@"my third action"); }]; one.backgroundcolor = [uicolor purplecolor]; two.backgroundcolor = [uicolor greencolor]; three.backgroundcolor = [uicolor browncolor]; return @[one, two, three]; }
Comments
Post a Comment