ios - How to solve this error "this class is not key value coding compliant for the key"? -
i have created uitableview
, in uitableview
every row have more 1 uitextfield
. how each uitextfield
values. below sample code.
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { int j= 285; (int i=0; i<7; i++) { nsstring *txtindvalue =[nsstring stringwithformat:@"index%d",i]; uitextfield *txtvalue = [[uitextfield alloc] initwithframe:cgrectmake(j,5.0f,25.0f,20.0f)]; [txtvalue setborderstyle:uitextborderstyleline]; [txtvalue settag:indexpath.row] [txtvalue setvalue:txtindvalue forkey:@"test"] [cell addsubview:txtvalue]; j = j + 35; } } error: terminating app due uncaught exception 'nsunknownkeyexception' ,reason :'[<uitextfield .>' setvalue:forundefindekey:] class not key value codeing compliant key. please me.
[txtvalue setvalue:txtindvalue forkey:@"test"]
this line causing crash. setvalueforkey
not property/method of uitextfield
. if want set text on textfield , should use
txt value.text = @"some text".
Comments
Post a Comment