Hi all,
So we have recently started developing applications for the iPad for our company. Unfortunately none of us here have ever done any iPhone/iPad development so we are just kind of learning on the fly and winging it. Basically our problem is happening when we try to push a view onto the screen when a table row is clicked. Neither of us can figure out why it's not doing it because the code looks 100% correct by anything we can tell. Here is what the didRowSelectedAtIndex: method looks like:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic -- create and push a new view controller
if(pdvController == nil)
pdvController = [[PersonDetailViewController alloc] initWithNibName:@"PersonDetailView" bundle:[NSBundle mainBundle]];
Person *aPerson = [appDelegate.people objectAtIndex:indexPath.row];
pdvController.aPerson = aPerson;
[self.appDelegate.navigationController pushViewController:pdvController animated:YES];
}
and here is the header for the toolbarSearchViewController:
#import <UIKit/UIKit.h>
#import "RecentSearchesController.h"
#import "PersonDetailViewController.h"
@class ToolbarSearchAppDelegate, PersonDetailViewController;
@interface ToolbarSearchViewController : UIViewController <UISearchBarDelegate, UIPopoverControllerDelegate, RecentSearchesDelegate> {
ToolbarSearchAppDelegate *appDelegate;
UIToolbar *toolbar;
UISearchBar *searchBar;
UITableView *resultsTable;
PersonDetailViewController *pdvController;
RecentSearchesController *recentSearchesController;
UITableViewController *resultsTableController;
UIPopoverController *recentSearchesPopoverController;
}
@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
@property (nonatomic, retain) UISearchBar *searchBar;
@property (nonatomic, retain) IBOutlet UITableView *resultsTable;
@property (nonatomic, retain) ToolbarSearchAppDelegate *appDelegate;
@property (nonatomic, retain) PersonDetailViewController *pdvController;
@property (nonatomic, retain) UITableViewController *resultsTableController;
@property (nonatomic, retain) RecentSearchesController *recentSearchesController;
@property (nonatomic, retain) UIPopoverController *recentSearchesPopoverController;
@end
and the ToolbarSearchAppDelegate header:
#import <UIKit/UIKit.h>
@class ToolbarSearchViewController;
@interface ToolbarSearchAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
ToolbarSearchViewController *viewController;
UINavigationController *navigationController;
NSMutableArray *people;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ToolbarSearchViewController *viewController;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) NSMutableArray *people;
@end
and finally the personDetailController.h:
#import <UIKit/UIKit.h>
@class Person;
@interface PersonDetailViewController : UIViewController {
IBOutlet UITableView *tableView;
Person *aPerson;
}
@property (nonatomic, retain) Person *aPerson;
@property (nonatomic, retain) UITableView *tableView;
@end
We are getting pretty annoyed because neither of us can figure out why it's not loading and any help or insight you guys could provide would be amazing. I wasn't sure what you may need to see, so if you need anything more specific, let me know and I will post it. Thanks!
ps. I am not sure how the code tags are going to handle all of Obj-c's quirky syntax, so if you see syntax errors, just ignore them. Assume that it is syntactically correct and will compile and run...