Hi everyone,
I am building an app that uses a TabBarController to display several other views. In one of these views, I'm using a navigation controller to navigate some tabular data. When the user click's this tab, I load in the NavigationController which in turn loads the TableView that I'm using. The issue is that I get the following error upon load of the TableView Controller:
-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x6b37b10
I have read everywhere that this type of error usually comes from a misconnection in IB or that a class is not correct in the view controller. Here is my code and screenshots of IB as to help debug this for me.
Thanks in advance!
The Error I'm Receiving
The TableView's Connections in IB
The File Owner's Class My Interface File
@interface FAQListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
// Dictionary that will hold the FAQ Key/Values
NSMutableArray *arrFAQData;
}
Implementation
@implementation FAQListViewController
// Implementation for UITableView numberOfRowsInSection protocol
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arrFAQData count];
}
// Implementation for UITableView cellForRowAtIndexPath protocol
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// See if we have any cells available for reuse
UITableViewCell *objCell = [tableView dequeueReusableCellWithIdentifier:@"FAQCell"];
if (objCell == nil) {
// No reusable cell exists, so let's create a new one
objCell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: @"FAQCell"];
}
// Give it data
NSDictionary *objRow = [arrFAQData objectAtIndex: [indexPath row]];
objCell.textLabel.text = [objRow valueForKey:@"Title"];
// Return the created cell
return objCell;
}
// Selection Event Handler
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Get the value for the selected key
NSDictionary *dictRow = [arrFAQData objectAtIndex:[indexPath row]];
NSString *strURL = [dictRow valueForKey: @"URL"];
// Alert result
UIAlertView *objAlert;
objAlert = [[UIAlertView alloc] initWithTitle:@"Alert" message: strURL delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
// Release created objects
[objAlert show];
[objAlert release];
// Deselect row
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)viewDidLoad {
// Pull in FAQ from Plist
NSString *strFAQPlist = [[NSBundle mainBundle] pathForResource:@"FAQData" ofType:@"plist"];
arrFAQData = [[NSMutableArray alloc] initWithContentsOfFile: strFAQPlist];
[super viewDidLoad];
}
- (void)dealloc {
[arrFAQData release];
[super dealloc];
}