#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Navigation Controller Pointer UITableView


    What I am trying to do is to make the Application Delegate Navigation Controller the Navigation Controller for a programmatically inserted tableView (only the view, not the view with navigation controller... if this is possible.



    What I was hoping for is that I could do something like the following:


    Code:
    navController = tableViewAppDelegate.navigationController;


    Code:
    	tableViewAppDelegate = (TableViewAppDelegate *) [[UIApplication sharedApplication] delegate];
    
    	DetailViewControllerSenateNoTossUp *cnewTableViewFrameController = [[DetailViewControllerSenateNoTossUp alloc] initWithNibName:@"DetailView" bundle:nil];
    	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:newTableViewFrameController];
    	
    
    
    	CGRect newTableViewFrame;
    	newTableViewFrame.origin.x = 0; 
    	newTableViewFrame.origin.y = 0;
    	newTableViewFrame.size.height = 200;
    	newTableViewFrame.size.width = 280;
    	
    	UIView *newTableView = [[UIView alloc] initWithFrame: newTableViewFrame];
    	newTableView = newTableViewFrameController.view;
    	
    	[self.view addSubview:newTableViewFrameController.view];
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0
    Here is the full block of code that I got to work:

    Code:
    	DetailViewControllerSenateNoTossUp *controller = [[DetailViewControllerSenateNoTossUp alloc] initWithNibName:@"DetailView" bundle:nil];
    	UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
    	navController.view.frame = CGRectMake(0, 0, 320, 416);
    	
    	[controller release];
    	
    	CGRect frame;
    	frame.origin.x = 0; 
    	frame.origin.y = 100;
    	frame.size.height = 200;
    	frame.size.width = 280;
    	
    	UIView *try = [[UIView alloc] init];
    	try = controller.tableView;
    	try.frame = frame;
    	
    	[self.tableView addSubview:try];
    	self.tableView = controller.tableView;
    	self.tableView.delegate = self;
    The most important part of this is the last three lines. It must also be in that order. 1) Add the new table view to your current view. 2) Set the current table view to equal the new table view. 3) Set the current table as the delegate.

    Code:
    [self.tableView addSubview:try];
    self.tableView = controller.tableView;
    self.tableView.delegate = self;

IMN logo majestic logo threadwatch logo seochat tools logo