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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:22:17+00:00 2026-06-04T14:22:17+00:00

i am using UITabBar to display two viewControllers, firstViewController is a uiview and secondViewController

  • 0

i am using UITabBar to display two viewControllers, firstViewController is a uiview and secondViewController is a table view. what my need is when i clicked the second view table cell, the value should be updated on UILabel of firstViewController.
my code is here,
In secondviewcontroller.h

 @interface firstviewcontroller {
 NSMutableArray *stationnamestobepassed;
  }
 @property (nonatomic, retain) NSMutableArray *stationnamestobepassed;
 @end

In secondviewcontroller.m declare this

@implementation firstviewcontroller
@synthesize stationnamestobepassed;

 -(void) someaction{
  stationnamestobepassed = [NSMutableArray     
    arrayWithObjects:@"string1",@"string2",@"string3"];
  secondviewcontroller = [[secondviewcontroller alloc]initWithNibName:@"NIbName" 
Bundle:nil];
  secondviewcontroller.stationnamespassed = self.stationnamestobepassed;
  //i am not pushing the view controller.

 }

@end

In firstviewcontroller.h declare this

@interface secondviewcontroller {
 NSMutableArray *stationnamespassed;
}
@property (nonatomic, retain) NSMutableArray *stationnamespassed;


@end

In firstviewcontroller.m declare this

@implementation secondviewcontroller
@synthesize stationnamespassed;

  -(void)viewWillAppear:(BOOL)animated
   {
  //stationNameDisplay is a uilabel

stationNameDisplay.text=[stationnamespassed objectAtIndex:0];
NSLog(@"station name %@",[stationnamespassed objectAtIndex:0]);

 }
  -(void) dealloc{
  [stationnamespassed release];
   [super release];
 }
@end

problem is , value is not updating and it gives NULL. but i tried with pushing the first vie and it works. actually i don’t want to push that view controller because i was already exist on tab.

  • 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-04T14:22:18+00:00Added an answer on June 4, 2026 at 2:22 pm

    your view will appear called out when you select the tab. while this line makes a new object of that controller, not that of tab controller.

    secondviewcontroller = [[secondviewcontroller alloc]initWithNibName:@"NIbName" 
    Bundle:nil];
    

    to do what you want. you will have to do some thing like this

    UINavigationController* navController = [[self.tabBarController viewControllers] objectAtIndex:/*your tab index on which desiredControllerResides*/];
    NSArray* viewControllers= [navController viewControllers];
    for(UIViewController *theController in viewControllers)
    {
    if([theController isKindOfClass:[secondviewcontroller]])
    {
       theController.stationnamespassed = self.stationnamestobepassed;
    //i.e  this line of your code secondviewcontroller.stationnamespassed = self.stationnamestobepassed;
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a simple iPhone application using a UITabBar and table views for
I have UITabBar in view which have 5 tabs. I am using didSelectItem delegate
I am using a UITabBar control from library in one of my view (note
Using PHP, I can convert MySQL data or static table data to csv, Excel,
I try to place UITabbar on iPhone window using CGRectMake. But I found that
I'm using a UITabBar without a controller. I want to remove tabs from the
I have an application with a UITabBar. I have implemented a Photo Gallery using
In my iphone application I put a UITabBar (not using UITabBarController) in the bottom
I have this case where I am using a custom UITabBar in my application.
Is anyone using MGSplitViewController inside a UITabBar ? My objective is basically to use

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.