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 7547135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:22:33+00:00 2026-05-30T09:22:33+00:00

I have searched a lot about this topic and I can’t get this code

  • 0

I have searched a lot about this topic and I can’t get this code work. When I execute it, it only shows my test NSLog but the code to go from one view to another doesn’t do anything. Here you have the following code:

//FirstViewController.h

#import <UIKit/UIKit.h>
#import "StationDetailsViewController.h"


@interface FirstViewController : UIViewController{
  NSArray *ListaEstaciones;
  NSArray *ListaID;
}
@property (nonatomic, retain) NSArray *ListaEstaciones;
@property (nonatomic, retain) NSArray *ListaID;
@end

//FirstViewController.m

#import "FirstViewController.h"
#import "StationDetailsViewController.h"
@implementation FirstViewController
@synthesize ListaEstaciones;
@synthesize ListaID;

//...

- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"Pushing...");
StationDetailsViewController *controller = [[StationDetailsViewController alloc] initWithNibName:@"StationDetailsViewController" bundle:nil];
[[self navigationController] pushViewController:controller animated:YES];
[controller release], controller = nil; 
}

@end

I have tried lots of tutorials and my book but I don’t know what is wrong. Thanks a lot, guys.

EDIT: Reading your answers I found that the error is on AppDelegate.m where rootViewController is defined.

//AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
    UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    UIViewController *viewController3 = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
    self.tabBarController = [[UITabBarController alloc] init];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, viewController3, nil];
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];

    return YES;
}

I don’t know what to edit here to make this:
[[self navigationController] pushViewController:controller animated:YES];
work properly.

  • 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-30T09:22:35+00:00Added an answer on May 30, 2026 at 9:22 am

    i think the problem is in [self navigationController] .. put a break point on this line of code and probaly you will find its value = nil cuz of that you are not having your detail controller .. you could solve this like that UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:yourMainViewControllerInstance];

    This The appDelegate Code :

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    UIViewController *firstViewController = [[[FirstViewController alloc] initWithNibName:@"FBConFirstViewController" bundle:nil] autorelease];
    UIViewController *secondViewController = [[[SecondViewController alloc] initWithNibName:@"FBConSecondViewController" bundle:nil] autorelease];
    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
     UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:firstViewController]autorelease];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav, secondViewController, nil];
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched a lot about the difference between Website and WebApplication but didn't
I have googled a lot and also searched in stackoverflow.com about how to sort
I have searched on this and found something about using remotely hosted JSPs but
I have searched a lot about UTF8 decoding, but not found the answer yet.
First of all, I know there are a lot of questions about this topic.
I want to implement vertical carousel in android.I have searched lot of things about
I have searched around, and it seems that this is a limitation in MS
I have searched the Web for this, but with no luck. Any idea? Thanks.
I have searched high and low for documentation on how to use this feature.
I have read a lot about the Java class loading process lately. Often I

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.