Skip to content

Instantly share code, notes, and snippets.

@alessaba
Created January 17, 2016 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alessaba/9e52da31899dcdd3d330 to your computer and use it in GitHub Desktop.
Save alessaba/9e52da31899dcdd3d330 to your computer and use it in GitHub Desktop.
Omtab.py
# coding: utf-8
from objc_util import *
import ui
def btnaction(sender):
print 'hellah'
tabvc=ObjCClass('UIApplication').sharedApplication().keyWindow().rootViewController().childViewControllers()[1]
toolbar=tabvc.toolbar()
btn=ui.Button(frame=(toolbar.size().width - 152 - 40,22,40,40))
btn.flex = 'R'
btn.action = btnaction
btn.image=ui.Image.named('iow:ios7_play_32')
objbtn=ObjCInstance(btn)
toolbar.addSubview_(objbtn)
'''
btnitem=ObjCClass('UIBarButtonItem').alloc().initWithCustomView_(objbtn)
barbutton=ObjCClass('OMBarButton').alloc().initWithBarButtonItem_(btnitem)
rightitems=list(toolbar.rightBarButtons())
rightitems.insert(-1,barbutton)
rightitems=ns(rightitems)
rightitems.init()
toolbar.rightBarButtons = rightitems
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment