Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stibi

macrumors newbie
Original poster
Hello. Please i need help with creating button in pyobjc app for iphone.
I know how create button instance:

Code:
button = UIButton.alloc().init()

But how set title for button ? Original Objective-C code is this:

Code:
[button setTitle:@"MyTitle" forState:UIControlStateNormal];

So pyobjc code is this: (?)

Code:
button.setTitle_forState_("MyTitle", UIControlStateNormal)

Problem is in UIControlStateNormal. This class not exist, only UIControl (in loaded UIKit framework). So how i specify state for title ?

Sorry for my bad english.
 
UIControlStateNormal is not a class: it's a constant (probably an integer). If you can't access the C constants over the Python bridge then substitute the correct integer instead...
 
Oh, of course, my bad. Thanks !!
Code:
button.setTitle_forState_("MyTitle", 0)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.