NSMatrix of buttons and Bind issue
This is my situation:
a NSMatrix (in radio mode) that contains 4 buttons
An object with properties "top","left","right","bottom" and the relative objectController.
each button has state bind to one of 开发者_JAVA技巧the objectController key (top,left,right,bottom).
Radio mode makes me sure that only one button at once has state = on, my problem is that when i select a button the object property chained to the objcet controller goes to 1, but the previous one selected (now with state = off) doesn't go to 0 (the buttons view works correctly and only 1 button is active at time).
How can i obtain a on/off effect also on the bind object?
Instead of binding each button, you should bind the selectedIndex
binding of the NSMatrix
itself to a property in your model.
You'll need to change the way you store the selected edge in your code by using a single property:
typedef enum {
TopEdge = 0,
RightEdge,
BottomEdge,
LeftEdge
} Edge;
@property Edge currentEdge;
This will allow you to keep track of the currently selected index.
精彩评论