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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:32:39+00:00 2026-06-10T14:32:39+00:00

okay i have a tabbed view, so two view controllers. in one view controller

  • 0

okay i have a tabbed view, so two view controllers. in one view controller i have a segmented control and to know which segment was selected i have an action connected to it. like this:

-(IBAction)selectAngle:(id)sender{
    clickedSegment = [myAngleType selectedSegmentIndex];
}

here clickedSegment is an integer which i have exposed as a property in my header. now i want to use the value of this clickedSegment in my other view controller but whenever i create an instance of that VC(segmented controller one) and try to use clickedSegment, i always get 0 as the value no matter if i selected other segment 1 or 2. its always zero. where am i going wrong?

  • 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-10T14:32:41+00:00Added an answer on June 10, 2026 at 2:32 pm

    How is your second view controller going to know about any property in the first view controller? This is impossible, unless you explicitly get a reference to it.

    // in second view controller
    FirstViewController *firstVC = 
       (FirstViewController*)[self.tabBarController.viewControllers objectAtIndex:0];
    
    NSLog(@"clicked segment: %d", firstVC.clickedSegment); // assuming int
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have a webView which loads a web page. The web view fits
Okay I have a series of objects based on a base class which are
Okay i have two models: posts and comments. as you can think comments has
Okay i have a custom server control that has some autocomplete settings, i have
Okay I have two classes for two links and two divs with different information.
Okay I have 2 files. One file is data that is updated every 10
Okay I have created an application where in one of the screens I have
Okay I have this RewriteRule which is supposed to redirect any request for the
Okay so I have the following Code which appends a string to another in
Okay so I have two tables: Companies | id int | name varchar(50) and

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.