Created
January 17, 2016 17:42
-
-
Save alessaba/9e52da31899dcdd3d330 to your computer and use it in GitHub Desktop.
Omtab.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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