Note that there are some explanatory texts on larger screens.

plurals
  1. POiPad/iPhone TableVIew help pushing a new view
    text
    copied!<p>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:</p> <pre><code>- (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]; } </code></pre> <p>and here is the header for the toolbarSearchViewController: </p> <pre><code> #import &lt;UIKit/UIKit.h&gt; #import "RecentSearchesController.h" #import "PersonDetailViewController.h" @class ToolbarSearchAppDelegate, PersonDetailViewController; @interface ToolbarSearchViewController : UIViewController &lt;UISearchBarDelegate, UIPopoverControllerDelegate, RecentSearchesDelegate&gt; { 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 </code></pre> <p>and the ToolbarSearchAppDelegate header:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @class ToolbarSearchViewController; @interface ToolbarSearchAppDelegate : NSObject &lt;UIApplicationDelegate&gt; { 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 </code></pre> <p>and finally the personDetailController.h:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @class Person; @interface PersonDetailViewController : UIViewController { IBOutlet UITableView *tableView; Person *aPerson; } @property (nonatomic, retain) Person *aPerson; @property (nonatomic, retain) UITableView *tableView; @end </code></pre> <p>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!</p> <p>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...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload