I added a pythonista ui view as a subview to an underlying native view.
Displaying labels and buttons is working fine. So I assume that I made no big error here.
Where my problem starts, is when I try to wire the button actions to methods in my view code.
I did it certainly the wrong way because the action delegates of the buttons are simply not called.
Here is my progress so far. Has anybody an idea how to connect the button action to methods in pythonista code?
from objc_util import *
WKWebView = ObjCClass('WKWebView')
UIViewController = ObjCClass('UIViewController')
rootVC = UIApplication.sharedApplication().keyWindow().rootViewController()
tabVC = rootVC.detailViewController()
CustomViewController = create_objc_class('CustomViewController', UIViewController, methods=, protocols=)
vc = CustomViewController.new().autorelease()
vc.title = 'View Test'
vc.navigationItem().rightBarButtonItems = 
webView = WKWebView.new().autorelease()
vc.view = webView
v = ui.View()
v.name = 'View Test'
v.width = 600
v.height = 300
v.background_color = 'red'
button = ui.Button(title='ok')
button.center = (v.width * 0.5,v.height * 0.5)
button.flex = 'LRTB'
button.action = btnclicked
if __name__ == '__main__':
PS: using a pythonista ui view instead of a native view as a super view is working as expected. (e.g. buttons delegates are called) So I assume it has something to do with the native view.