objective c - NSSwitchCell doesn't change value after clicking it -


i've bound nsswitchcells column nsarraycontroller. values on/off correctly displayed, when click on it, value doesn't change. switch box gives visual feedback of clicking value remains same (checked or unchecked).

enter image description here

i've tried sort of binding options.

 nsdictionary *bindingoptions = [nsdictionary dictionarywithobjectsandkeys:                                                 [nsnumber numberwithinteger:1], nscontinuouslyupdatesvaluebindingoption,                                                  [nsnumber numberwithinteger:1], nsraisesfornotapplicablekeysbindingoption,                                                 [nsnumber numberwithinteger:1], nsconditionallysetseditablebindingoption,                                                 [nsnumber numberwithinteger:1], nsvalidatesimmediatelybindingoption,                                                  nil];                 [tablecolumn bind:@"value" toobject:currentitemsarraycontroller withkeypath:[nsstring stringwithformat:@"arrangedobjects.%@", editedcolumnmetadata.columnbindingkeypath] options:bindingoptions];     [(nsbuttoncell*)cell setbuttontype:nsswitchbutton];                 [cell settitle:@""];                 [tablecolumn setdatacell:cell]; 

thanks

update: (binding cell ?)

 //[tablecolumn bind:@"value" toobject:currentitemsarraycontroller withkeypath:[nsstring stringwithformat:@"arrangedobjects.%@", editedcolumnmetadata.columnbindingkeypath] options:bindingoptions];  [cell bind:@"objectvalue" toobject:currentitemsarraycontroller withkeypath:[nsstring stringwithformat:@"arrangedobjects.%@", editedcolumnmetadata.columnbindingkeypath] options:bindingoptions]; 

you have follow below steps , let me know if required more details:-

first have bind column of checkbox cell arraycontroller inside binding inspector attached in screenshots below.

enter image description here

second thing in array controller if want update value of checkbox cell write below action method , connect action method table column of checkbox cell only.

-(ibaction)clickchekboxcell:(id)sender {     nsinteger chkcell=[sender integervalue];     nsnumber *num=[nsnumber numberwithinteger:chkcell];     nsmutabledictionary *dict=[nsmutabledictionary dictionary];     for(dict in [arrcont arrangedobjects])     {         [dict setobject:num forkey:@"checkyesno"];     }     [arrcont rearrangeobjects]; } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -