Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>check out my blog it will surely help you. here is the link.</p> <p><a href="http://blog.paxcel.net/blog/expandablecollapsible-table-for-ios/" rel="nofollow">Expandable/Collapsible Table For iOS</a></p> <p>you need to do the following things</p> <ol> <li>First design your classes according to your json file as in my case it is "Category".</li> <li>Once you are done with model classes you need to edit the following method to prepare array of model objects. </li> </ol> <blockquote> <p>Hint: From json, we can directly find out our dictionary like</p> </blockquote> <pre><code>id result = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&amp;error]; </code></pre> <p>where result can further casted to get the dictinary object. And the load data simply like the following method</p> <pre><code> - (void) setCategoryArray { NSURL *url = [[NSBundle mainBundle] URLForResource:@”CategoryList” withExtension:@”plist”]; NSArray *mainArray = [[NSArray alloc] initWithContentsOfURL:url]; NSMutableArray *categoryArray = [[NSMutableArray alloc] initWithCapacity:[mainArray count]]; for (NSDictionary *dictionary in mainArray) { Category *category = [[Category alloc] init]; category.name = [dictionary objectForKey:@"name"]; category.list = [dictionary objectForKey:@"list"]; [categoryArray addObject:category]; } self.categoryList = categoryArray; } </code></pre> <ol> <li>Once this done, the only thing left to edit the table view's data source and delegate methods accordingly.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload