UITableViewCell default effect, when the cell is pressed, the cell will get gray background.The UITableViewCell child view control will also change the background color. How to let the child views background doesn't change?
Asked
Active
Viewed 304 times
0
-
Similar to this question http://stackoverflow.com/questions/26895370/swift-uitableviewcell-selected-background-color-on-multiple-selection?rq=1 – muneeb Apr 15 '16 at 00:51
-
I look at the website you provide, the effect is not what I want.But still want to thank you. – ChildrenGreens Apr 16 '16 at 03:13
2 Answers
0
This may be suitable for you:
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
-
I need to effect: when a cell is pressed, the background color is grey.Loosen the finger cell back to the original effect. – ChildrenGreens Apr 16 '16 at 03:14
0
Use this code,
let cell:UITableViewCell = UITableViewCell(style:UITableViewCellStyle.Default, reuseIdentifier:"cell")
cell.selectionStyle = UITableViewCellSelectionStyle.None
return cell
hope its helpful

Iyyappan Ravi
- 3,205
- 2
- 16
- 30
-
I need to effect: when a cell is pressed, the background color is grey.Loosen the finger cell back to the original effect – ChildrenGreens Apr 16 '16 at 03:13
-
you need effects use this, **didSelectRowAtIndexPath:** method 'tableView.deselectRowAtIndexPath(indexPath, animated: true)' – Iyyappan Ravi Apr 16 '16 at 04:17
-
This way I know, but the child views set the background color of the cell and presented the above problems. – ChildrenGreens Apr 16 '16 at 08:14
-
-
UITableViewCell, under the finger press, what method is called? – ChildrenGreens Apr 17 '16 at 13:12
-
if you finger press the UITableViewCell called **didSelectRowAtIndexPath:** method. – Iyyappan Ravi Apr 18 '16 at 04:19
-
I just tested.When the fingers touch up cell, didSelectRowAtIndexPath: method is called – ChildrenGreens Apr 20 '16 at 00:46