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

The Archive Base Latest Questions

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

I have a UIViewController NavigationViewController that is added as a subview of my FirstViewController

  • 0

I have a UIViewController “NavigationViewController” that is added as a subview of my “FirstViewController” that takes up the whole screen (i.e. similar to the Flipboard Navigation controller in the iPad application). Many views are added and removed based on what selection the user makes. I want to be able to push a view controller to the “FirstViewController” navigationController from within the “many views” that are added. In this case the “FeaturedViewController” is one of those many views that can be selected. It inherits ContentViewController where the delegate protocol is defined.

TL;DR I want to access the navigationcontroller in the first view to push a view from the added subview “FeaturedViewController”.

Here is a visual representation:
enter image description here

Here is the my code from:

Here is my current attempt that does not work. Note, I took some code out relating to the “Navigation Controller”

/* First View Controller */

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

@interface ViewController : UIViewController <BaseViewDelegate, ContentViewDelegate>
{
    IBOutlet UINavigationController *navigationController;
    ContentViewController *contentView;
}

@property (strong, nonatomic) IBOutlet UINavigationController *navigationController;
@property (strong, nonatomic) ContentViewController *contentView;

---------------------------------------------------------

#import "ViewController.h"
#import "NavigatorViewController.h"
#import "BinViewController.h"

@implementation ViewController
@synthesize navigationController, contentView;

static NSArray *viewArray = nil;

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.navigationController.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    [self.view addSubview:navigationController.view];

    // Navigation View is used to navigate throughout the entire application
    NavigatorViewController *navController = [[NavigatorViewController alloc] init];

    contentView = [[ContentViewController alloc] init];

    contentView.delegate = self;

    // Add the views to the array (using ARC)
    viewArray = [NSArray arrayWithObjects:navController, contentView, nil];

}

-(void)displayNavigator
{
    // Get the right view controller    
    UIViewController *viewController = [viewArray objectAtIndex:0];
    // Add the subview to the view
    [self.view addSubview:viewController.view];
}

-(void)pushViewController:(UIViewController *)viewController 
{    
    NSLog(@"First View Push View Controller called");

    [self.navigationController pushViewController:viewController animated:YES];
}
@end

/* Content View Controller */

@class ContentViewController;
@protocol ContentViewDelegate <NSObject>
-(void)pushViewController:(UIViewController *)viewController;
@end

@interface ContentViewController : UIViewController 
{
    __weak id <ContentViewDelegate> delegate;    
}

@property (weak) __weak id <ContentViewDelegate> delegate;

- (void)pushView:(UIViewController *)viewController;

@end

---------------------------------------------------------

#import "ContentViewController.h"
#import "BinViewController.h"

@implementation ContentViewController

@synthesize delegate;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];    
}

- (void)pushView:(UIViewController *)viewController
{        

    NSLOG(@"Push View from ContentViewController");
    if ([delegate respondsToSelector:@selector(pushViewController)])
      [delegate pushViewController];

}

@end

/* View that is added to the navigator view (it inherits ContentViewController where the delegate protocol is defined)*/
#import <UIKit/UIKit.h>
#import "ContentViewController.h"

@interface FeaturedViewController : ContentViewController <CustomPagingDelegate>

@end

---------------------------------------------------------

#import "FeaturedViewController.h"
#import "BinViewController.h"

@implementation FeaturedViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];

}

- (void) touchUpInsideItemAtIndex:(NSUInteger)itemIndex 
{
   //  [[[[[self view] superview] superview] superview] removeFromSuperview];
    NSLOG(@"Touch up inside from featured view");

    BinViewController *binViewController = [[BinViewController alloc] init];

    [self pushView:binViewController];    
}

@end
  • 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:52:43+00:00Added an answer on May 27, 2026 at 3:52 pm

    Many to one or one to many sounds like easiest route would be to use NSNotificationCenter.

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

Sidebar

Related Questions

I have a UIViewController that I've added UITableViewDelegate to. This controller has a corresponding
I have a UIViewController that contains a subview and a UIToolbar. I'm trying to
I have a UIViewController and in that controller, i am fetching an image from
I have a UIViewController that instantiates several UIImageViews on the screen. Is it possible
I have a UIViewController (firstViewController) which has a button that 'segue's to another UIViewController
I have a UIViewController which is embedded in a navigation controller and presented modally:
I have a problem with data in UITableView. I have UIViewController, that contains UITableView
I have a UIViewController that manages the display of some data. When the user
i have a UIViewController that is only about 260px tall(or at least the area
I have a UIViewController whose view has a custom subview. This custom subview needs

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.