Forum Archive

Change disclosure_indicator color in TableViewCell

mieq

Hello,I want to make a dark mode for my view. But how can I change the disclosure_indicator color in TableViewCell? Thank you!

Imgur

cvp

@mieq you could use ObjectiveC AccessoryView instead of default AccessoryType, like quick and dirty shown here

import ui
from objc_util import *

class source (object):
    def tableview_number_of_rows(self, tv, s):
        return 4

    def tableview_cell_for_row(self, tv, s, r):
        type = {0:'default', 1:'subtitle', 2:'value1', 3:'value2'}[r]
        cell = ui.TableViewCell(type)
        if r == 0:
            print(dir(ObjCInstance(cell)))
            v = ui.Button()
            v.background_color = 'red'
            v.frame = (0,0,32,32)
            v.title = '>'
            vo = ObjCInstance(v)
            ObjCInstance(cell).setAccessoryView_(vo)
        cell.text_label.text = 'Title'
        try:
            cell.detail_text_label.text = 'Detail'
        except AttributeError:
            pass
        try:
            cell.image_view.image = ui.Image.named('ionicons-image-32')
        except AttributeError:
            pass
        return cell

view = ui.TableView()

view.data_source = source()

view.present() 
cvp

@mieq or

            #v.background_color = 'red'
            v.tint_color = 'red' 
mieq

@cvp perfect! In fact, I found out how to implement it with Objc by Google, but I don't know how to convert it to Python. and your code is a great example for me to learn. Thanks a lot!

Imgur