Note that there are some explanatory texts on larger screens.

plurals
  1. POiphone development: table view returns empty table
    primarykey
    data
    text
    <p>I am brand new to iOS development, and I could not find a solution on here or Google, so I'm asking out of desperation.</p> <p>I have a class "ViewController" that is a subclass of UIViewController. In here, I have:</p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([self.bookTitle.text length] &gt; 0) self.entries = [self.bookLibrary searchForBook:self.bookTitle.text]; if ([segue.identifier isEqualToString: @"BookList"]) { TableViewController *controller = (TableViewController *)segue.destinationViewController; controller.itemCounter = [self.entries count]; controller.bookLibrary = [self.entries allValues]; } } </code></pre> <p>The view for this on the Storyboard has a connection to a Table View Controller that I dragged and dropped onto the grid. I clicked the "Table View Controller" at the bottom, and set my custom class "TableViewController" in the custom class input box.</p> <p>Now, from what I understand, the method above is passing all the data properly to the TableViewController. </p> <p>Here's one of the methods I have in the TableViewController</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"BookCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; } Book* book = [self.bookLibrary objectAtIndex:indexPath.row]; cell.textLabel.text = book.title; NSLog(@"%@", book.title); return cell; </code></pre> <p>}</p> <p>The NSLog entry is printing out all the book titles to the console, so I know for a fact the data is being passed. However, when I run the program and click the button to pull up the Table View, it's just an empty table. Any hints? I can upload my entire project. Been at this for several hours and a bit frustrated. Please help :(</p> <p>EDIT: A response suggested I look at the state of my data variables in the table methods. It suggests their state is not what I think it is and that I should use NSLog to print out their values. I did just that, and I can see all the values printed out. I don't understand... they do infact have values assigned to them. The problem isn't that the data is missing.</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.
 

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