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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:59:35+00:00 2026-06-18T15:59:35+00:00

I have a Navigation Controller embedded in a RootViewController. The elements present inside the

  • 0

I have a Navigation Controller embedded in a RootViewController. The elements present inside the RootViewController are a segmented control and a UIView. As the different segments are selected, the UIView displays a corresponding ViewController.

Now each of the ViewController being displayed in the UIView is a UITableViewController.

I need to display the table values as per the segment selections. And also if any of the row of the table is selected, it has to move to a newer ViewController with the detailed view.

I am able to display the UITableViewControllers as per the segment change. However, when i click on the row of the table, the newer ViewController that comes up is blank (Black Screen) even though I have created the particular ViewController in the Storyboard and set up an identifier as well.

Code for the Segmented Control change in ViewController.m

- (void)segmentedControlChangedValue:(UISegmentedControl*)segmentedControl {

int selIndex = segmentedControl.selectedIndex;

if (selIndex == 0)
{
    aTable = [[aTableViewController alloc] init];

    aTable.view.frame = self.myView.bounds;
    [self.myView addSubview:aTable.view];
    [self addChildViewController:aTable];
}

if (selIndex == 1)
{
    bTable = [[bTableViewController alloc] init];

    bTable.view.frame = self.myView.bounds;
    [self.myView addSubview:bTable.view];
    [self addChildViewController:bTable];

}

if (selIndex == 2)
{
    //NSLog (@"Well you selected a 3rd option");
}}

Code for the didSelectRowAtIndexPath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[super tableView:tableView didSelectRowAtIndexPath:indexPath];

newDetailController* newController = [self.storyboard instantiateViewControllerWithIdentifier:@"Detail"];

newController = [[newDetailController alloc] init];

[[self navigationController] pushViewController:newController animated:YES];}

The pushViewController pushes an empty view for me even though I have specified the ViewController to use in the Storyboard design and also using an identifier.

Please help me in understanding what I must do to rectify this error.

UPDATE – The above problem has been resolved.

The problem I face now is being unable to access the data in the newViewController.

I pass the data to the newViewController as follows:

  1. Create a class named newClass which contains all the elements I want to pass across.

  2. Create a NSMutableArray “newObjects” in the firstViewController.

  3. Create each newClass object at this method.

    • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
      {

    static NSString *CellIdentifier = @"Cell";

    customBigTableCell *cell = (customBigTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
    cell = [[customBigTableCell alloc] init];
    }

    cell.name.text = [object objectForKey:@"objName"];

    newClass* newObj = [[newClass alloc] init];

    newObj.objName = cell.name.text;

    [newObjects addObject:newObj];

    return cell;
    }

    Pls pardon me .. for the indenting with the code block is messed up…
    Also the PFObject is cos i use Parse for database.

  4. Add the created object to the newObjects array.

  5. In the - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath method, this is the code

    • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
      [super tableView:tableView didSelectRowAtIndexPath:indexPath];

      UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@”MainStoryboard” bundle:[NSBundle mainBundle]];

      newDetailController* newController = [storyboard instantiateViewControllerWithIdentifier:@”UpcomingDetail”];

      obj = [[newClass alloc] init];

      NSIndexPath* path = [self.tableView indexPathForSelectedRow];

      obj = [newObjects objectAtIndex:path.row];

      NSLog(@”Row selected is %ld”, (long)path.row); //this returns the correct row selected

      NSLog(@”Movie selected is %@”, [[newObjects objectAtIndex:path.row] objName]);//however this is not the right one as per the cellForRowAtIndexPath method.

      [newController setNewObj:obj];

      [[self navigationController] pushViewController:newController animated:YES];
      }

When I run this code, the row is selected correctly. However I dont get the corresponding row in the database. The array gets stored with redundant data.

  • 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-06-18T15:59:37+00:00Added an answer on June 18, 2026 at 3:59 pm

    You need to get rid of that middle line:

    newController = [[newDetailController alloc] init];
    

    That just redefines newController (as an empty controller with no view set up), which you defined in the first line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three scenes embedded inside a Navigation Controller. Scene1: Takes input from user,
I have a Modal View Controller, and a Navigation View Controller embedded in a
I have added a navigation controller inside a viewcontroller thats inside another navigation controller...
I have a view controller that's embedded in a navigation controller. Therefore this view
I have the following (view) controller arrangement: an uitableview --(embedded in)--> navigation controller --(embedded
I have a navigation controller app. I created a RootViewController class with Xib file.
i have 3 navigation controller and i want to change each background using different
I have a UIViewController which is embedded in a navigation controller and presented modally:
I have a navigation controller that displays viewcontroller A. There is a right button
I have a table view that is embedded inside a regular view controller (which

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.