Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone dev - Having problems adding text to cells of a UITableView
    primarykey
    data
    text
    <p>I am trying to make an app that will display a bunch of different people's names and address in different cells of a UITableView. First I'm just trying to get the hand of adding text to the cells, and it's not really working. I have the following code, where myTableViewController is just a subclass of UITableViewController that loads in its view from a nib (without any drastic customizations):</p> <pre><code> myTableViewController * tvc = [[myTableViewController alloc] initWithStyle:UITableViewStylePlain]; NSIndexPath *path1 =[NSIndexPath indexPathForRow:0 inSection:0]; NSIndexPath *path2 =[NSIndexPath indexPathForRow:1 inSection:0]; [self presentModalViewController:tvc animated:YES]; UITableViewCell * cell1 = [tvc.tableView cellForRowAtIndexPath:path1]; UITableViewCell * cell2 = [tvc.tableView cellForRowAtIndexPath:path2]; cell1.textLabel.text = @"test"; cell2.textLabel.text = @"test2"; </code></pre> <p>I was expecting to see a tableView animate onto the screen, followed by the first and second cells being filled with the text "test" and "test2" respectively. What I get is a blank tableview animating onto the screen. Then if I scroll down so that the top cell is hidden and scroll back up so that the top cell is again visible, the top cell will now have the text "test" in it. But the second cell down never shows any text, just the top one.</p> <p>Can someone please point me in the right direction? I also would like to have the text in the tableview BEFORE it loads onto the screen, but it looks like the cells don't exist unless they are being displayed. Please help me.</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. This table or related slice is empty.
    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