I’m trying to write an app that will have a custom tableviewcell so i followed the apple developer sample code, but when i run my app, the screen is completely white. When I put breakpoints/NSLogs in the numberOfSectionsInTableView, numberOfRowsInSection, or the cellForRowAtIndexPath, nothing shows.
Here is my delegate.m
RootViewController *rootViewController = [[RootViewController alloc]initWithStyle:UITableViewStylePlain];
rootViewController.displayList=[self displayList];
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navigationController=aNavigationController;
[aNavigationController release];
[rootViewController release];
[window addSubview:[navigationController view]];
[self.window makeKeyAndVisible];
And this is the cellForRowAtIndexPath in my RootViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"TableCell";
TableCell *tableCell = (TableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (tableCell == nil) {
tableCell = [[[TableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
tableCell.frame=CGRectMake(0.0, 0.0, 320.0, 60);
}
NSLog(@"71");
return tableCell;
}
I know that the cellForRowAtIndexPath won’t show if there are no rows, but shouldn’t the numberOfRowsInSection at least work? I even commented the numberOfRowsInSection out and the app was still able to build (still blank though)
Thanks
Did you hook up the viewcontroller as the owner of the xib file? and then connect the datasource and delegate methods to the file owner?
EDIT: If you haven’t created a xib file for your tableview, I recommend it over coding it out. After you create it, just connect everything like I mentioned. Also create one for your tableviewcell, and then load it in the cellForRowAtIndexPath