Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Paix247

macrumors 6502
Original poster
Jul 26, 2006
363
1
Minneapolis
I have a Tab Bar Controller app all set up with 4 tabs - (it finally starts without errors or exceptions!). Two tabs display a simple tableview, one tab shows a static 'about' page, and the 4th tab shows a Navigation Controller.

I have everything working except the table in my Navigation tab is blank. The controller class is working somewhat, because the name of the Navigation shows up both in the Tab title and in the Navigation Bar title; however, my table is blank!

Basically, I tried to tie in Apple's Simple Drill Down app into my Tab Bar Controller, and I think I did something wrong in the translation.
I'll post some of my code & screen shots, and let me know if you need to know anything else.


//
// SectionsViewController.h
//

#import <UIKit/UIKit.h>
@class DataController;
@interface SectionsViewController : UITableViewController {
DataController *dataController;
}
@property (nonatomic, retain) DataController *dataController;
@end
//
// SectionsAppDelegate.m
//

#import "SectionsViewController.h"
#import "DataController.h"
#import "DetailViewController.h"


@implementation SectionsViewController
@synthesize dataController;

- (void)awakeFromNib {
self.title = NSLocalizedString(@"Restaurants", @"Master view navigation title");
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

return [dataController countOfList];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:mad:"MyIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:mad:"MyIdentifier"] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}

NSDictionary *itemAtIndex = (NSDictionary *)[dataController objectInListAtIndex:indexPath.row];
cell.text = [itemAtIndex objectForKey:mad:"title"];
return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

DetailViewController *detailViewController = [[DetailViewController alloc] initWithStyle:UITableViewStyleGrouped];

detailViewController.detailItem = [dataController objectInListAtIndex:indexPath.row];

[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];
}

- (void)dealloc {

[dataController release];
[super dealloc];
}
@end
//
// SectionsAppDelegate.h
//

#import <UIKit/UIKit.h>
@class DataController;
@class SectionsViewController;
@interface SectionsAppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UIWindow *window;

IBOutlet UITabBarController *rootController;
DataController *dataController;

}

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) UITabBarController *rootController;

@property (nonatomic, retain) DataController *dataController;

@end
//
// SectionsAppDelegate.m
//

#import "SectionsAppDelegate.h"
#import "SectionsViewController.h"
#import "DataController.h"

@implementation SectionsAppDelegate
@synthesize window;
@synthesize dataController;
@synthesize rootController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {

[window addSubview:rootController.view];
[window makeKeyAndVisible];
}


- (void)dealloc {

[rootController release];
[window release];
[super dealloc];
}
@end
Picture1.png

//
Picture2.png

//
Picture3.png
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.