Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6960495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:24:34+00:00 2026-05-27T15:24:34+00:00

I am trying to push in a new view controller with the code: [self.navigationController

  • 0

I am trying to push in a new view controller with the code:

[self.navigationController pushViewController:webViewController animated:YES];

But its not working. This code happens when you select a cell in my table view. I have a table view which I think is preventing this from happening. I have tried presenting it modally but that gets rid of the navigation bar and i can’t go back. There is an extremely similar to this but the answer didn’t work for me!

UPDATE

- (void)loadView {
    // Create an instance of UIWebView as large as the screen
    CGRect screenFrame = [[UIScreen mainScreen] applicationFrame];
    UIWebView *wv = [[UIWebView alloc] initWithFrame:screenFrame];
    // Tell web view to scale web content to fit within bounds of webview 
    [wv setScalesPageToFit:YES];

    [self setView:wv];
    [wv release];
}

puts the web view as the WebViewController’s view

there is no nib as shown above

the didSelect cell method IS CALLED using an NSLog to find out

Everything is initialized and allocated and non-zero

UPDATE:

my did select cell method:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Push the web view controller onto the navigaton stack - this implicity
    // creates the web view controller's view the first time through

    NSLog(@"TOUCHED!");

    webViewController = [[WebViewController alloc] init];

    if (webViewController == nil) {
        NSLog(@"webViewController in nil state");
    }

    [self.navigationController pushViewController:webViewController animated:YES];


    // Grab the selected item
    RSSItem *entry = [[channel items] objectAtIndex:[indexPath row]];

    // Construct a URL with the link string of the item
    NSURL *url = [NSURL URLWithString:[entry link]];

    // Construct a request object with that URL
    NSURLRequest *req = [NSURLRequest requestWithURL:url];

    // Load the request into the web view
    [[webViewController webView] loadRequest:req];

    // Set the title of the web view controller's navigation item
    [[webViewController navigationItem] setTitle:[entry title]];

}

ALL OF THIS WORKED BEFORE INSERTING TAB BAR CONTROLLER

UPDATE

Where I create the controllers (IN APP DELEGATE):

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

             self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    ListViewController *lvc = [[ListViewController alloc] initWithStyle:UITableViewStylePlain];

    [lvc autorelease];
    // Create the tabBarController
    UITabBarController *tabBarController = [[UITabBarController alloc] init];

    // Create two view controllers
    UIViewController *vc1 = [[ListViewController alloc] initWithStyle:UITableViewStyleGrouped];
    UIViewController *vc2 = [[YoutubeViewController alloc] init];

    // Make an array containing the two view controllers
    NSArray *viewControllers = [NSArray arrayWithObjects:vc1, vc2, nil];

    // The viewControllers array retains vc1 and vc2, we can release
    // our ownership of them in this method
    [vc1 release];
    [vc2 release];

    // Attach them to the tab bar controller
    [tabBarController setViewControllers:viewControllers];

    // Put the tabBarController's view on the window
    [[self window] setRootViewController:tabBarController];

    // The window retains tabBarController, we can release our reference
    [tabBarController release];

    // Show the window
    [[self window] makeKeyAndVisible];

    return YES;
}

So I really have no idea whats going on here. Also IF YOU COULD PLEASE HELP ME WITH ANOTHER QUESTION! Go to my profile and see the question about how to stop cutoffs/add extra line for text label in uitableviewcell

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:24:35+00:00Added an answer on May 27, 2026 at 3:24 pm

    I don’t see the initial UINavigationViewController in your app delegate. In order to use the self.navigationController pushViewController, the view controller needs to be in one of the self.navigationController.viewControllers. Can you modify your code and try the following and see it works for you.

    // Create two view controllers
    UIViewController *vc1 = [[ListViewController alloc] initWithStyle:UITableViewStyleGrouped];
    UIViewController *vc2 = [[YoutubeViewController alloc] init];
    
    // Create the UINavigationController and put the list view controller as the root view controller
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:vc1];
    
    // Make an array containing the two view controllers and the UINavigationController which has the ListViewController is the first one.
    NSArray *viewControllers = [NSArray arrayWithObjects:navController, vc2, nil];
    
    // The viewControllers array retains vc1 and vc2, we can release
    // our ownership of them in this method
    [vc1 release];
    [vc2 release];
    [navController release];
    
    // Attach them to the tab bar controller
    [tabBarController setViewControllers:viewControllers];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the following code to push a new view controller on
Ive been trying to push a new view when a cell is tapped but
I'm trying to push a new view on my navigation controller using: -(IBAction)switchPage:(id)sender {
Hey! I am not trying to push my luck here but I have another
I have a view controller that i'm trying to push onto the navigation stack.
I am trying to save data to a database on a button push, but
I have a navigationController, I push a new viewController onto it's stack, I have
I was trying to follow the Table View Programming Guide for iPhone OS but
new to this site, but my head is absolutely killing me after trying for
I am using a split view controller in an iPad app I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.