ios - Create tableView sections dynamically using array in iPhone -


I have the app in which I want to show data in the table view section The problem is that I do not know the names of the total squares Because it depends on the array, how to show data for each section of the cell for the row on the index path.

  NSArray * test = [NSArray arrayWithObjects: @ "20 June", @ "20 July", "May 1", @ "May 10", zero];   

So I want to show data in the table, as all the records of June 20 should be shown in one section and all records of May all will be shown on May 1. Everyone goes for something to know how to solve it. Thanks

( Personally, it is best to create standard structure, I would suggest the following

  • Code> key And, say, June 20 , this value
  • event is a

    Possible UITableViewController subclass methods

      Code> - (zero) viewDidoadload [[Super Viewedload]; @ "D @ @ "@": "@" @ "Events": @ [@ "Repair Window Panel", @ "Buy Elephant Buy", @ "Pay Credit Card Payable"]}, @ "@" @ "Days": @ "May 1", @ @ "Events": @ [@ "Repair Window Frame", @ "Buy More Food for Elephants", @ "Pay Credit Card Amount due"], @ {@ "Day" , @ "Events": @ [@ "Change entire window", @ "Buy elephants, get cat", @ "return credit card"]}, @ {@ "de": @ "May 10", @ " Events ": @ [@" Take Take ", @" Shawe ", @" Get New Credit Card "]}]; }   #pragma icon - table view data source - (NSInteger) numberOfSectionsInTableView: (UITableView *) tableView {// main array calculation (basically how many days ) Return arrTest.count; } - (NSInteger) Table view: (UITableView *) table view numberofrose insusction: (NSInteger) section {// calculate the number of events on a particular day / event // the old style // return [[[arrTest objectArt: section] Objectwork : @ "Events"] calculation]; Return [arrTest [section] [@ "events"] count]; } - (NSString *) Table view: (UITableView *) Table view title ForHeaderInSection: (NSInteger) section {// "Get the value of" day "key (June 20 / July 20 ...) // Old style // return [[ArrTest ObjectAtIndex: section] objectForKey: @ "day"]; Return arrTest [section] [@ "day"]; }   - (UITableViewCell *) TableView: (UITableView *) Table View CellForAindPath: (NSIndexPath *) indexPath {static NSString * CellIdentifier = @ "cell"; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {cell = [[UITABLE DOCKEY alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier]; } // old style // NSString * strDayEvent = [[[arrTest object atindexx: index.path.section] objectforekey: @ "events"] objectoutindex: indexpath.ro]; NSString * strDayEvent = arrTest [indexPath.section] [@ "events"] [indexPath.row]; [Cell.textLabel setText: strDayEvent]; Return cell; }    

  • Comments

    Popular posts from this blog

    Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

    multithreading - PhantomJS-Node in a for Loop -

    c++ - MATLAB .m file to .mex file using Matlab Compiler -