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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:22:15+00:00 2026-05-28T03:22:15+00:00

Maybe a stupid question but I have to do it as soon as possible.

  • 0

Maybe a stupid question but I have to do it as soon as possible. My problem is:

I have four tabbar controllers A,B,C,D and these are imported a viewcontroller (suppose name button controller) at the navigation bar.

So, A,B,C,D are importing this buttonview controller like this #import buttonViewController.h in every .h file of A,B,C,D tabbar controller.

Now problem is, in buttonViewController I have a button which action calling the “A” tabbar controller or “B”, “C”,or “D” tabbar controller.

I have already added buttonViewController in every A,B,C,D tabbarcontroller.

How can I do this?

  • 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-28T03:22:15+00:00Added an answer on May 28, 2026 at 3:22 am

    Ha ha ha …..it was so much fun when i solved it.whatever i solved this problem in different way, i did not use scrollview button controller for controller just, in every controller i have made function to where buttons within a scrollview create and on action of button i have just change the selected index of the tabbar controller.

    in -(void)viewDidload i wrote this code

         UIView *scrollViewBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 45)];
    scrollViewBackgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"topmenu_bg.png"]];
    
    menuScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(5,0,320,40)];
    menuScrollView.showsHorizontalScrollIndicator = FALSE;
    menuScrollView.showsVerticalScrollIndicator = FALSE;
    menuScrollView.bounces = TRUE;
    [scrollViewBackgroundView addSubview:menuScrollView];
    [self.view addSubview:scrollViewBackgroundView];
    
    [self createMenuWithButtonSize:CGSizeMake(92.0, 30.0) withOffset:5.0f noOfButtons:7];   
    

    here is the button create and action

    -(void)mybuttons:(id)sender{    
    NSLog(@"mybuttons called");
    UIButton *button=(UIButton *)sender;
    NSLog(@"button clicked is : %iBut \n\n",button.tag);
    int m = button.tag;
    for(int j=0;j<8;j++){
        if(button.tag == m){
            self.tabBarController.selectedIndex = m;
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_hover.png"] forState:UIControlStateHighlighted]; //sets the background Image]            
        }
        if(button.tag != m){
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
        }
    }
    }       
    
     -(void)createMenuWithButtonSize:(CGSize)buttonSize withOffset:(CGFloat)offset noOfButtons:(int)totalNoOfButtons{
    
    NSLog(@"inserting into the function for menu bar button creation"); 
    for (int i = 0; i < totalNoOfButtons; i++) {
    
        UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
        [button addTarget:self action:@selector(mybuttons:) forControlEvents:UIControlEventTouchUpInside];
        (button).titleLabel.font =  [UIFont fontWithName:@"Arial" size:12];
        if(i==0){
            [button setTitle:[NSString stringWithFormat:@"Dashboard"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_hover.png"] forState:UIControlStateNormal]; //sets the background Image]
        }
        if(i==1){
            [button setTitle:[NSString stringWithFormat:@"Order"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
    
        }
        if(i==2){
            [button setTitle:[NSString stringWithFormat:@"Product"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
    
        }
        if(i==3){
            [button setTitle:[NSString stringWithFormat:@"Customers"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
    
        }
        if(i==4){
            [button setTitle:[NSString stringWithFormat:@"Content"] forState:UIControlStateNormal];//with title
        }
        if(i==5){
            [button setTitle:[NSString stringWithFormat:@"Site Analysis"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
    
        }
        if(i==6){
            [button setTitle:[NSString stringWithFormat:@"Store Settings"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
    
        }
        if(i==7){
            [button setTitle:[NSString stringWithFormat:@"CMS Settings"] forState:UIControlStateNormal];//with title
            [button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
    
        }
        button.frame = CGRectMake(i*(offset+buttonSize.width), 6.0, buttonSize.width, buttonSize.height);
        button.clipsToBounds = YES;
        button.showsTouchWhenHighlighted=YES;
        button.layer.cornerRadius = 5;//half of the width
        button.layer.borderColor=[UIColor clearColor].CGColor;
        button.layer.borderWidth=0.0f;
        button.tag=i;
        [menuScrollView addSubview:button];
    }
    menuScrollView.contentSize=CGSizeMake((buttonSize.width + offset) * totalNoOfButtons, buttonSize.height);
    [self.view addSubview:menuScrollView];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, maybe it is a stupid question, but I cannot resolve this problem. In
Maybe this is a stupid question but it's bugging me. I have a bi-directional
maybe this is a stupid question, but i have seen many Tuts that build
I'am new to jquery and maybe this is a stupid question but I have
This may be a stupid question, but I have to ask! I have the
This question is for a web application. And maybe it's a stupid question but
This maybe a stupid question, but as I can not easily undo my change
Maybe is just a stupid question, but, I would appreciate having an explanation of
I know maybe this is a stupid question, But i suck at sql But
I know this maybe a stupid question but maybe I'm just confused with the

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.