GregInAZ
Sep 24, 2008, 03:45 PM
In my XIB I have a view with it's own view controller (ViewController.m/.h). I also have a navigation controller that I dropped a tableview into. I created a table view controller class (CategoryViewController.m/.h) for the table view and hooked up the datasource and delegate to it. I added the following delegate methods to CategoryViewController.m:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath
and in the CategoryViewController.h file I added:
<UITableViewDelegate, UITableViewDataSource>
So it looks like:
@interface CategoryViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
In my ViewController.m class I'm trying to show the navigation with the table view in it using:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[self presentModalViewController:categoryNavigation animated:TRUE];
categoryNavigation is synthesized in the ViewController.m class, it's a property in the .h and it's an IBOutlet and hooked up through IB.
When I execute this code I get an exception "EXC_BAD_ACCESS". If I remove the datasource connection in IB for the tableview and try again it shows what I wanted to see except that the table is empty.
Anyone know what I'm doing wrong?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath
and in the CategoryViewController.h file I added:
<UITableViewDelegate, UITableViewDataSource>
So it looks like:
@interface CategoryViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
In my ViewController.m class I'm trying to show the navigation with the table view in it using:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[self presentModalViewController:categoryNavigation animated:TRUE];
categoryNavigation is synthesized in the ViewController.m class, it's a property in the .h and it's an IBOutlet and hooked up through IB.
When I execute this code I get an exception "EXC_BAD_ACCESS". If I remove the datasource connection in IB for the tableview and try again it shows what I wanted to see except that the table is empty.
Anyone know what I'm doing wrong?
