Copy NSArray and replace text items with bool values

Posted by Frank Martin on Stack Overflow See other posts from Stack Overflow or by Frank Martin
Published on 2010-06-04T15:41:30Z Indexed on 2010/06/05 7:02 UTC
Read the original article Hit count: 249

Filed under:
|
|

I utilize a (nested) plist to populate UITableViews where users can select entries at the deepest levels and set a checkmark (or not). I want to save these selections in a same structured list where at the deepest level the NSArray contains bool values instead the text strings that are displayed in the UITableView.

So how can i build from a hierarchy like the following:

Root
 - Item 0 (Dictionary)
   - Group (Dictionary)
     - Items (NSArray)
       - Item 0: @"Please check me" (String)

a hierarchy like this?

Root
 - Item 0 (Dictionary)
   - Group (Dictionary)
     - Items (NSArray)
       - Item 0: 0 (NSNumber) // NSNumber for bool values

I'm trying to create a deep mutable copy and replace the items at the deepest levels but have somehow the feeling that this can be done easier.

Thanks for any help with this in advance.

Frank

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c