1

So I have a UIViewController class called SocialMainViewController. It has an instance of a TwitterViewController (which inherits from an UITableViewController) and an instance of a FacebookViewController (which also inherits from an UITableViewController).

@interface SocialMainViewController ()

@property (strong, nonatomic) TwitterViewController* twitterVC;
@property (strong, nonatomic) FacebookViewController* facebookVC;
...
@end

@implementation SocialMainViewController

@synthesize twitterVC = _twitterVC;
@synthesize facebookVC = _facebookVC;
..

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIColor* color = [[UIColor alloc] initWithRed:0.2 green:0.2 blue:0.2 alpha:1.0];
    [self.navigationController.navigationBar setTintColor:color];

    // Do any additional setup after loading the view
    self.facebookVC = [[FacebookViewController alloc] init];
    self.facebookVC.view.frame = self.view.bounds;
    [self.view addSubview:self.facebookVC.view];
}

So the Facebook view controller gets all the information from facebook and store it in an array. But the cellForRowAtIndexPath on that FacebookViewController class never gets called and hence only an empty table view is visible.

I'm actually trying to switch between the facebookviewcontroller and twitterviewcontroller tableviews. That is why I had the two inside the socialmainviewcontroller.

ppranav
  • 39
  • 4
  • Does `tableView:numberOfRowsInSection:` get called? If yes, check what it's returning; if no, there may be a problem with the table's connection to its data source. – Phillip Mills May 24 '12 at 20:50
  • If FacebookViewController is a subclass of UITableViewController, it is better to call initWithStyle: rather than init. http://stackoverflow.com/questions/743010/which-initializers-to-override-for-uitableviewcontroller-subclass – Sierra Alpha May 24 '12 at 20:58
  • You need to show the code where you switch between the two table view controllers. – rdelmar May 24 '12 at 23:53
  • Thanks Phillip. So I figured the array where i was saving the facebook feeds was empty when tableView:numberOfRowsInSection: was called. But once i load all the feeds in the array I call [self.tableview reloadData] in my FacebookViewController class. But for some reason the table view datasource methods don't get called again. Anybody know what is going on? – ppranav May 25 '12 at 15:29

0 Answers0