Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>By "static data" do you mean hard coded rather than from a data source? </p> <p>Either way the process is the same. You have to return cells via cellAtIndexPath: You can do this quite simply with an "if block" assuming all you want is a couple of hard coded rows.</p> <p>For example:</p> <pre><code>// How many sections in the table? Hard coded to 1 here - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // How many rows in the table? Hard coded to 2 here - (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection:(NSInteger)section { return 2; } // Method for returning data from anywhere, even hard coded // Notice how we use row and section, these tell us which cell in the table we are returning - (UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath { NSInteger row = [indexPath row]; NSInteger section = [indexPath section]; // Dequeue a cell using a common ID string of your choosing UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCellID"]; // Return cells with data/labels/pretty colors here if (row == 0) { cell.textLabel.text = @"I can haz cheezburger"; } else if (row == 1) { cell.textLabel.text = @"I hate lol catz"; } // Pretty em up here if you like cell.selectionStyle = UITableViewCellSelectionStyleGray; cell.textLabel.lineBreakMode = UILineBreakModeWordWrap; return cell; } </code></pre> <p>It's pretty straightforward once you know the Cocoa way, but it's not "simple".</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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