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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:33:42+00:00 2026-06-13T20:33:42+00:00

I have following view controllers hierarchy: View Controller VC1 Tab Bar Controller TBC1 –

  • 0

I have following view controllers hierarchy:

  • View Controller VC1
  • Tab Bar Controller TBC1 – configured in storyboard to lead to a Table View Controller TVC1 and a Map View Controller MVC1
  • Table View Controller TVC1
  • Table View Controller TVC2

In VC1, I do this:

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

This rightly brings up tab bar controller, with TVC1 in focus.

TVC1 shows back button in its navigation bar (programmatically created from VC1 code), which will get me to VC1, which is expected.

However, from TVC1 onwards, I need one more navigation to TVC2. I am trying to add right button to the TVC1 navigation bar for this, but it doesn’t show up.

Here is the code I use in TVC1 (rightButton is UIButton type property of TVC1):

   self.rightButton = [[UIBarButtonItem alloc]
                            initWithBarButtonSystemItem: UIBarButtonSystemItemAdd
                            target: self
                            action: @selector(MySelector:)];
   self.rightButton.style = UIBarButtonItemStyleBordered;
   self.rightButton.title = @"";
   self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:   self.rightButton, nil];

(specified blank title and style just to ensure if that’s the issue which is causing this, I don’t actually need those values)

MySelector is declared in TVC1.h as:

- (void) MySelector:(id)sender;

And it is properly implemented, too.

But rightButton above does not display in TVC1 navigation bar.

What am I missing?
I suspect its with TBC1 (tab bar) that comes between VC1 and TVC1, and somehow it resets navigation properties.

But then I argue that I see navigation bar on TVC1, and a left button leading to VC1.
I checked that in TBC1, self.navigationItem.rightBarButtonItems has 1 object inside which is definitely the rightButton I am adding.

Where am I wrong?

Note: Above is found in all of iOS 5.0, 5.1 and 6.0 simulators.

  • 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-13T20:33:43+00:00Added an answer on June 13, 2026 at 8:33 pm

    It seems to me that your are missing UINavigationController between TVC1 and TVC2 in your storyboard. If you are using storyboards then you can create navigation item Add button type on the navigation controller itself and have a PUSH segue to TVC2. See this diagram if that makes sense. If this doesn’t solve your problem then please upload example code and I will have a look.

    [EDIT]

    I had reproduced your issue by creating your view controllers structure in storyboard.

    storyboard

    If you notice here TVC1 doesn’t have it’s UINavigationController but it is inheriting it from VC1. Solution to your problem is rather than adding rightButton onto self add it to self.parentViewController and you will see rightButton in TVC1. But mind you it will also appear in MVC1 as it is belong to TBC1’s parent. You can hide right bar button in MVC1’s viewWillAppear if you don’t want it there. Following is the code.

    self.rightButton = [[UIBarButtonItem alloc]
                        initWithBarButtonSystemItem: UIBarButtonSystemItemAdd
                        target: self
                        action: @selector(MySelector:)];
    self.rightButton.style = UIBarButtonItemStyleBordered;
    self.parentViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects: self.rightButton,nil];
    

    If you want to Add right button into the TVC1’s navigation controller then you need Embed TVC1 into UINavigationController. To do this, select TVC1 screen in the storyboard -> Editor -> Embed In->Navigation Controller. When you do this your code will also work and will show you right button but you will have two navigation controllers(see image below) in it because of your structure of storyboard. You will need to hide Parent’s navigation controller in to the TVC1’s view did load and have left button to Pop to Parentview Controller. You do the same in MVC1.

    Hope this helps! Happy coding 🙂

    output

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

Sidebar

Related Questions

I have the following controller which contains a view: Lead.Controllers.UrlSearch = Ember.Object.extend init: ->
I have this view controller with the following hierarchy: I am just trying to
I have created segues in the following way: view controller VC1 is the root
I have the following view controller in my UIPopover: @protocol StorePopoverDelegate - (void)storeSelected:(NSString *)store;
I have the following View, Controller and Comment.cs code, but I get an error,
I have the following model, view and controller. Model public class Person { public
I have the following ActionLink in my view <%= Html.ActionLink(LinkText, Action, Controller); %> and
If i have a controller action Create that returns a view with the following
I have the following view and table in my project, vw_get_arabia_upod_full_details arabia_upod_item_avalability_master I want
I have a view controller, which creates 2 view controllers inside it. Inside each

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.