Hello, everyone
I've started dabbling with objc_util module by trying out sample code provided with Pythonista and reading iOS docs. I find the whole idea of using Objective C from Python exciting. I've managed to set a property like backgroundColor on ui.View. What's struck me is the long time it takes. Almost 3x as long as for normal ui.View. Besides, first I get the default 'vanilla' view and then it gets colored. Any ideas what I am missing here?
from objc_util import *
import ui
import time
# WORKS THE SAME WAY as in Myclass below
#cl = UIColor.alloc()
#cl = cl.init().initWithRed_green_blue_alpha_(.2, .3, .6, 1.).autorelease()
class Myclass (ui.View):
def __init__(self):
#ui.View.__init__(self) #changes nothing
ocv = ObjCInstance(self._objc_ptr)
cl = UIColor.blueColor()
ocv.backgroundColor = cl
start = time.clock()
v = Myclass()
v.present('sheet')
print time.clock()-start
start = time.clock()
v2 = ui.View()
v2.background_color('blue')
v2.present('sheet')
print time.clock()-start
Thanx in advance.