ios - Index sections from plist -
I have a plan that I am trying to sort in sections. I have everything setup and it is working but one thing that I can not set is that it counts numberOfRowsInSection
. At the moment, this first section should only be the image on the 'b'
Shows shown in
The problem I am having is that I am using plist to populate the table, but it can not understand the need to sort the table alphabetically according to the below section count. is.
// Find the path to the dishes. Plist NSString * path = [[NSBundle main bundle] Pathfoser resource: @ "Law" type: @ "Plist"]; // Load the file contents and read the data in the array NSDictionary * dict = [[NSDictionary alloc] initWithContentsOfFile: path]; // load data in the autoa self.tableData = [dict objectForKey: @ "law"]; Self.tableIndexData = [Dial objectForKey: @ "Index"]; // index containing - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {// NSString * sectionTitle = [self.tableIndexData objectAtIndex: section]; // NSArray * sectionAnimals = [Automated Data Objective: SectionTitle]; Return [Automated Data Count]; }
Multi section tables usually have arrays within arrays, or arrays within arrays, or arrays within the array. This is a case in your code because the structure "Structure" constructed by your object is not clear from the code shown by you. (If you display the data, as if it is placed in Plast, it will be very easy for people).
The "law" from your code object takes 1 level compared to the dictionary with an array (array array or nested array. Your code accepts the structure:
< code> - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection (NSInteger) section {// NSString * sectionTitle = [self.tableIndexData objectAtIndex: section]; // NSArray * sectionAnimals = [self.tableData objectForKey: sectionTitle]; return [Self-Tavaldata counting];}
What do you have to do, the first correct structure for 1 ( words with nested arrays or nested ara Oshon of Srnian )
Once you should have something like this with an array of nested arrays that structure, dictionary code for tableviewNumberOfRowsInSection:
- (NSInteger) numberOfSectionsInTableView :( UITableView *) table view {return ([font_family_array count]);} - (NSInteger) Talikadrishy: (UITableView *) table view Snkyaofrejh Insashn: (NSInteger) section {NSDictionary * dictionary = [Font_family_array objectswithindex: section]; NSArray * array = [Dictionary objectForKey: @ "array"]; NSInteger count = [ARAR count]; Return (count); }
The section header should then be set to the following:
- (NSString *) tableView: (UITableView *) tableView titleForHeaderInSection: ( NSInteger) section {NSDictionary * dict = [font_family_array objectAtIndex: section]; NSString * title1 = [dict objectForKey: @ "family"]; Return (title 1); }
In the example below, font_family_array is an array of dictionaries with 2 elements, which contains the title / title and contains @ Nested Array or content in Array as stated It is possible that an array of arrays is also possible,
Comments
Post a Comment