Change Selected Text Color in TableView
As said in the title, I just want to change the text color and the background color of the selected cell in my custom TableView. No problem for the background color but the text color keep his none selected color …
Here is my code inside my tableview_cell_for_row def :
selected_cell = ui.View() selected_cell.background_color = (.25, .51, 1.0, 1) selected_cell.text_color = (1, 1, 1, 1.0) cell.selected_background_view = selected_cell
Do you see something wrong or is it simply impossible ?
of course, needs
from objc_util import *
All seems possible and so simple with SuperCVP ;-)
I think I need to try to work on UIKit and ObjC !
@Enez-Houad Please, don't think that about me, just
- Google search "uitableview selected color"
- found setHighlightedTextColor_
and voilà 😀
I throught it was possible to do it directly from Pythonista as changing the selected bg color was possible. I has not the reflex ObjC, I know I should.
@Enez-Houad do not worry, personally I took more than a year to get this reflex (but I'm old and slow, as my wife says 😂)
@Enez-Houad If you want to make your TableView more nice, you can even put an image as background.
Assuming tbl is your ui.TableView:
ObjCInstance(tbl).setBackgroundView_(ObjCInstance(ui.ImageView(image = ui.Image.named('test:Peppers'), content_mode=ui.CONTENT_SCALE_ASPECT_FILL)))