objective c - UITableViewCell on selection highlighting color -
i have implemented tableview in viewcontroller. have not given cell selection style.
what problem facing is, when click on of cell becomes gray. should happen background should become gray , not whole cell. here whole cell becomes gray.
can provide solution this? in advance!
you have implement custom selection style following steps.
first, want disable default selection behaviour:
- (void)awakefromnib { [super awakefromnib]; self.selectionstyle = uitableviewcellselectionstylenone; }
second, override sethighlighted method (when user tap cell , not yet raise finger):
- (void)sethighlighted:(bool)highlighted animated:(bool)animated { [super sethighlighted:highlighted animated:animated]; // configure view selected state self.yourview.background = [uicolor graycolor]; }
third, override setselected method (when user tapped , raise finger):
- (void)setselected:(bool)selected animated:(bool)animated { [super setselected:selected animated:animated]; // configure view selected state self.yourview.background = [uicolor graycolor]; }
finally, want deselect cell in tableview @ proper time calling:
[self.tableview deselectrowatindexpath:animated:];
Comments
Post a Comment