How Do I Bind a UIButton Property to Another Property?

Posted by cygnl7 on Stack Overflow See other posts from Stack Overflow or by cygnl7
Published on 2011-02-02T07:00:54Z Indexed on 2011/02/02 7:25 UTC
Read the original article Hit count: 190

Filed under:
|
|
|

UIButton eventually inherits from NSObject, and NSObject implements NSKeyValueBindingCreation Protocol. So why can't I bind a UIButton's property to another class' property?

[myUIButton bind:@"enabled"
        toObject:myOtherObject
     withKeyPath:@"otherObjectBOOLProperty"
         options:nil];

This results in the warning

'UIButton' may not respond to '-bind:toObject:withKeyPath:options:'

What I'm trying to do is bind the enabled state of my UIButton to myOtherObject.otherObjectBOOLProperty.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios