I am currently developing an app to show fixtures in football competition using data organized in an NSArrays. , Showing 1 round 3 matches for round example, to put the data in the section ie i want to show round 2 6 matches etc.
Can someone please help me with how I can show the data in a uitable classes?
Regards John
I usually use NSArrays in an NSArray for this Please.
This is how I will create a data source table:
NSArray * section0 = [NSArray arrayWithObjects: @ "Section 0 Row 0" @ "Section 0 Row 1" , Zero]; NSArray * section1 = [NSArray arrayWithObjects: @ "section 1 line 0", @ "section 1 line 1", @ "section 1 line 2", zero]; Self.tableViewData = [NSArray arrayWithObjects: section0, section1, zero]; and some UITableView methods so you get the idea:
- (NSInteger) numberOfSectionsInTableView: (UITableView *) tableView {return [self.tableViewData count]; } - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {return [[self.tableViewData objectAtIndex: section] count]; } - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {MyObject * Object = [[self.tableViewData objectAtIndex: indexPath.section] objectAtIndex: indexPath.row]; // something) and for the titles of the sections (and indexed) I create separate NSArrays. I
Comments
Post a Comment