omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Change disclosure_indicator color in TableViewCell

    Pythonista
    2
    4
    1526
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mieq
      mieq last edited by 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 2 Replies Last reply Reply Quote 0
      • cvp
        cvp @mieq last edited by 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() 
        
        1 Reply Last reply Reply Quote 1
        • cvp
          cvp @mieq last edited by

          @mieq or

                      #v.background_color = 'red'
                      v.tint_color = 'red' 
          
          mieq 1 Reply Last reply Reply Quote 1
          • mieq
            mieq @cvp last edited by 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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors