Tuesday, 15 January 2013

objective c - iOS. Add object to NSMutableArray in valueForKeyPath -



objective c - iOS. Add object to NSMutableArray in valueForKeyPath -

if have nsmutablearray looks this:

self.securityquestionsmutablearray = [[nsmutablearray alloc] init]; // how add together object or objects `nsmutablearray` //[self.securityquestionsmutablearray addobject:@""]; { reply = ""; description = "id number"; displaytext = "id number"; fieldname = idnumber; secuityquestionid = 1; }, { reply = ""; description = "test question"; displaytext = "test question"; fieldname = "test questionr"; secuityquestionid = 2; }

how can add together object or objects in valueforkeypath@"answer" valueforkeypath nsmutablearray existing nsmutablearray

you can set values of individual nsmutabledictionary objects key-value pair this

[[self.securityquestionsmutablearray objectatindex:index] setvalue:@"new value" forkeypath:@"answer"];

here index point specific object within array. remember objects within array should of mutable dictionary type. if utilize nsdictionary object, crash.

ios objective-c nsmutablearray

No comments:

Post a Comment