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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:00:08+00:00 2026-05-31T21:00:08+00:00

This is the code from the class within which I am trying to reference

  • 0

This is the code from the class within which I am trying to reference the properties from the other class(BIDDoubleComponentPickerViewController):

BIDDoubleComponentPickerViewController *dummyObject = [BIDDoubleComponentPickerViewController new];
NSString *selectedValue = [dummyObject value];
NSString *selectedSuit = [dummyObject suit];

However, whenever I attempt to access the variables selectedValue and selectedSuit, they claim that they are null, when I know for a fact that value and suit are not null within the other class. Here is the code that sets the properties in BIDDoubleComponentPickerViewController:

NSInteger valueRow = [doublePicker selectedRowInComponent:
                        kValueComponent];
NSInteger suitRow = [doublePicker selectedRowInComponent:
                      kSuitComponent];
value=[[NSString alloc]initWithString:[values objectAtIndex:valueRow]];
suit=[[NSString alloc]initWithString:[suits objectAtIndex:suitRow]];

Here is the code for the declaration of the properties:

@property (strong, nonatomic) NSString *value;
@property (strong, nonatomic) NSString *suit;

Anyone have any ideas?

  • 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-31T21:00:10+00:00Added an answer on May 31, 2026 at 9:00 pm

    When you create a new view controller, it doesn’t load its view immediately. So if the code where you initialize value and suit is located in the init method, then doublePicker is still nil. Otherwise, if that code is located in viewDidLoad or loadView, then it is still not executed when you try to access value and suit using [dummyObject value]; and [dummyObject suit];


    Edit: (After OP’s comment)

    My answer is still correct because in the line:

    BIDDoubleComponentPickerViewController *dummyObject = [BIDDoubleComponentPickerViewController new];
    

    you create a new object dummyObject that is different from the view controller where the picker view was visible. So the values value and suit that you are looking for are properties of the other view controller and not the one you just initialized.

    To solve your problem, you should not create a new instance of BIDDoubleComponentPickerViewController but retrieve the instance that holds the values you are looking for.

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

Sidebar

Related Questions

This code attempts to dynamically switch the class of the StateContainer div from StateOne
I have this sample code for async operations (copied from the interwebs) public class
I'm try something from this comment idea Code Igniter Controller/Model name conflicts find class
i'm trying to do this from inside the .m of a custom view class
In this code (from the WCF REST starterkit - preview2): protected override SampleItem OnAddItem(SampleItem
I got this code from the wordpress <head profile=http://gmpg.org/xfn/11> What does this means? what
I copied this code from an example . I've read it 100 times. Array.prototype.map
I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
I got this code from someone, it's almost perfect to create a dynamic breadcrumb,
I got this code from someone and it works very well, I just want

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.