@robertiii , I took the method that @technoway wrote in post and just changed it to a function. So you should be able to call that function with an already presented uiView and a hex color. Look, I dont really have any exp using the ui.Navigation view. It’s a little funky. So the below may not work, but its a starting point. I think it will work.
Ok, hope it helps
import ui
from objc_util import ObjCInstance, UIColor
from time import sleep
def change_title_bar_color(v, hex_color):
""" Change the title bar color to the passed color.
"""
vv = ObjCInstance(v)
bar_bckgnd = vv.superview().superview().superview().subviews()[1].subviews()[0]
bar_bckgnd.backgroundColor = UIColor.colorWithHexString_(hex_color)
class MyClass(ui.View):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.make_view()
def make_view(self):
pass
if __name__ == '__main__':
f = (0, 0, 300, 400)
v = MyClass(frame=f)
v.present(style='sheet', animated=False)
'''
You may or may not need the sleep method as I have done below. If I dont
use it on my iPad pro, I get an error, something about obj does not have
superview. Basically going to fast. The function is being called before
the view is fully created.
if you didnt want the sleep, quite a few different ways you could work
around it.
Maybe one of the guys could comment if using @on_main_thread decorator on
the function would stop this from happening or not.
I could experiment, but I would not understand what is really happening.
'''
sleep(.01)
change_title_bar_color(v, '#ff0000')