Does anyone know how to change the background color of a cell using UITableViewCell, for each selected cell? I created this UITableViewCell inside the code for TableView.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Emacs/xterm color annoyance on Linux
- TransitionFromView removes previous view
Create a custom UITableViewCell. Inside you custom class override the "setSelected" function and change the contentView background color. You can also override you "setHighlighted" function.
In Swift:
Changing the property selectedBackgroundView is correct and the simplest way. I use the following code to change the selection color:
Check out
AdvancedTableViewCells
in Apple's sample code.You'll want to use the composite cell pattern.
Works for me
I have tried each one among above answers, but none of them best fits for me,
then i have looked into one of the native provided method, and it is working fine.
first, make cellSelectionStyle to None and then go for this solution.
advantage of this methods over other all is :