Note that there are some explanatory texts on larger screens.

plurals
  1. POTableView Does NOT Switch to Detail View When Connected to Tab Bar Controller
    primarykey
    data
    text
    <p>I have created a Tab Bar Application, removed the default FirstView and SecondView and added the following two ViewControllers:</p> <ol> <li>JustAnotherView (which is simply a UIViewController with a UIView inside)</li> <li>MyListOfItems (which is a UIViewController with a TableView inside)</li> </ol> <p>I have a 3rd ViewController called ListOfItemsDetailViewController with a UIView inside that is supposed to be called when the user touches one of the TableView cells.</p> <p>The application compiles without issue. I can touch both Tab Bar buttons and the correct View appear.</p> <p>PROBLEM: When I click a TableView cell, the code to switch to the Detail View is executed (without crashing or error), but the View is NEVER shown.</p> <p>Here is a screenshot of the application and the debugger with an NSLog that shows it made it past the pushViewController without crashing:</p> <p><a href="http://clip2net.com/clip/m52549/thumb640/1281588813-9c0ba-161kb.jpg" rel="nofollow noreferrer">http://clip2net.com/clip/m52549/thumb640/1281588813-9c0ba-161kb.jpg</a></p> <p>Here is the code.</p> <p>MyListOfItemsViewController.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import &lt;Foundation/Foundation.h&gt; #import "ListOfItemsDetailViewController.h"; @interface MyListOfItemsViewController : UIViewController { ListOfItemsDetailViewController *listOfItemsDetailViewController; } @property (nonatomic, retain) ListOfItemsDetailViewController *listOfItemsDetailViewController; @end </code></pre> <p>Here is the MyListOfItemsViewController.m file:</p> <pre><code>#import "MyListOfItemsViewController.h" @implementation MyListOfItemsViewController @synthesize listOfItemsDetailViewController; #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; self.title = @"My List Of Items"; NSLog(@"My List Of Items Did Load"); } #pragma mark - #pragma mark Table view data source // Customize the number of sections in the table view. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; NSString *cellMessage; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cellMessage = [NSString stringWithFormat:@"indexPath: %d",indexPath.row]; cell.textLabel.text = cellMessage; return cell; } #pragma mark - #pragma mark Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ListOfItemsDetailViewController *vcListOfItemsDetail = [[ListOfItemsDetailViewController alloc] initWithNibName:@"ListOfItemsDetail" bundle:[NSBundle mainBundle]]; self.listOfItemsDetailViewController = vcListOfItemsDetail; [vcListOfItemsDetail release]; [self.navigationController pushViewController:self.listOfItemsDetailViewController animated:YES]; NSLog(@"Did Execute didSelectRowAtIndexPath WITHOUT Crashing or Error."); } #pragma mark - #pragma mark Memory management - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Relinquish ownership any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. // For example: self.myOutlet = nil; NSLog(@"My List Of Items View Did Unload"); } - (void)dealloc { [super dealloc]; } @end </code></pre> <p>Please help. It will be very much appreciated!!!</p> <p>I have been driving myself crazy trying to get basic navigation down in the iOS platform.</p> <p>Also, pardon the layperson question, I know that most of you already understand how to do this.</p> <p>Thanks in advance. Jaosn</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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