Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to populate UITableView from NSMutable array from another view
    primarykey
    data
    text
    <p>I have 2 VCs, first is <code>BooksDetailViewController</code> which has the NSString <code>myBookString</code>. Another on is <code>FavBooksViewController</code> which has the <code>favBookList</code> NSMutableArray. I want to pass the NSString <code>myBookString</code> from the 1st VC to include it in the <code>favBookList</code> NSMutableArray which then populates the table.</p> <p>I have included <code>@class FavBooksViewController;</code> in the <code>BooksDetailViewController.h</code></p> <p>Imported <code>#import "FavBooksViewController.h"</code> in the <code>BooksDetailViewController.m</code></p> <p>The action in the <code>BooksDetailViewController.m</code> looks like this:</p> <pre><code>- (IBAction)addToFav:(id)sender { FavBooksViewController *mdvc; [mdvc.self.favBookList addObject:myBookString]; } </code></pre> <p>In <code>FavBooksViewController.h</code> I have </p> <pre><code>@interface FavBooksViewController : UIViewController &lt;UITableViewDataSource, UITableViewDelegate&gt; @property (strong, nonatomic) id delegate; @property (nonatomic,strong) NSMutableArray *favBookList; </code></pre> <p>In the <code>FavBooksViewController.m</code> - <code>#import "FavBooksDetailViewController.h"</code> In the ViewDidLoad I tried to include this line </p> <pre><code>self.favBookList = [[NSMutableArray alloc]initWithObjects:nil]; </code></pre> <p>But I have commented it out. With it our without it the UITableView isn't working. And of course I have this:</p> <pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.favBookList count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"favBooksCell"]; cell.textLabel.text = [self.favBookList objectAtIndex:indexPath.row]; return cell; } </code></pre> <p>No matter what, the UITableView is just empty, no cells, nothing. What can be the possible mistake here? What am I doing wrong? Thanks in advance!</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.
 

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