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

  • Home
  • SEARCH
  • 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 552231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:28:39+00:00 2026-05-13T11:28:39+00:00

I have a controllerView (MenuControllerView) with a button inside, when I click on the

  • 0

I have a controllerView (MenuControllerView) with a button inside, when I click on the button a new ViewController will appear with a TabBarController created programmatically like this:


UIView* topView = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];

tabBarController = [[UITabBarController alloc] init];
viewController1 = [[ViewController1 alloc] init];
viewController2 = [[ViewController2 alloc] init];
viewController3 = [[ViewController3 alloc] init];
viewController4 = [[ViewController4 alloc] init];

tabBarController,viewControllers = [NSArray arrayWithObjects:viewController1 , viewController2 , viewController3 ,viewController4, nil];
[[self tabBarController] setSelectedIndex:1];
[topView addSubView:[tabBarController view]];

Instead of displaying ViewController1 for the first button Item, I want to put an action Back in it to return to my MenuViewController, but I don’t know how how to do it.

Thanks

  • 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-13T11:28:39+00:00Added an answer on May 13, 2026 at 11:28 am

    Have you considered presenting the UITabBarController as a modal view controller and implementing UITabBarControllerDelegate? e.g. this seems to work for me (I make the third tab return to MenuViewController here):

    @interface MenuViewController : UIViewController <UITabBarControllerDelegate>
    ...
    
    - (IBAction) onButtonPressed:(id)sender
    {
    
        UITabBarController* tabBarController = [[UITabBarController alloc] init];
        viewController1 = [[ViewController1 alloc] init];
        viewController2 = [[ViewController2 alloc] init];
        viewController3 = [[ViewController3 alloc] init];
    
        tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1 , viewController2 , viewController3 , nil];
        [[self tabBarController] setSelectedIndex:1];
    
        tabBarController.delegate = self;
        [self presentModalViewController:tabBarController animated:NO];
    }
    
    - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;
    {
        if (viewController == viewController3)
        {
            [self dismissModalViewControllerAnimated:NO];
            return NO;
        }
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a snippet to create a 'Like' button for our news site: <iframe
I have found this example on StackOverflow: var people = new List<Person> { new
I have a method which looks like this: - (void)testMethod:(int)myNumber { switch (myNumber) {
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have 4 UIViews inside of a main view controller view. All I need
I have been developing in ASP.NET MVC for a short while. Up to this
I have a tabbar based application. The tabbarcontroller is on the top of the
Very likely I'm going about this in the wrong way entirely. I'm completely new
I have a new web app that is packaged as a WAR as part
I have this iPad application with different NIBs and views. Each view has two

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.