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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:05:35+00:00 2026-06-06T06:05:35+00:00

My numberOfComponentsInPickerView : – (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 3; } My numberOfRowsInComponent : –

  • 0

My numberOfComponentsInPickerView :

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 3;
}

My numberOfRowsInComponent :

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    if (component == 0)
        return 100;
    if (component == 1)
        return 100;
    if (component == 2)
        return 100;

    return 0;
}

My titleForRow like this:

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{    
    if (component == 0)
        return [NSString stringWithFormat:@"%d", row];
    if (component == 1)
        return [NSString stringWithFormat:@"%d", row];
    if (component == 2)
        return [NSString stringWithFormat:@"%d", row];

    return 0;
}

my didSelectRow like this
after edited like Paras Joshi’s said :

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    int year = [picker selectedRowInComponent:0];
    int month = [picker selectedRowInComponent:1];
    int day = [picker selectedRowInComponent:2];
    if(viewPicker.tag == 1)
        labelDate1.text = [year stringByAppendingFormat:@" : %d : %d", month, day];
    else
        labelDate2.text = [year stringByAppendingFormat:@" : %d : %d", month, day];
}

it still gives me error ” bad receiver type ‘int’ ” and i still don’t get it how to fix it. how my label get data from titleForRow?

both input for year month and day all are number only (from 0 to 99) so that i wrote -> return [NSString stringWithFormat:@”%d”, row];

i dont put data for my pickerview at – (void)viewDidLoad because i want my labelDate1 or labelDate2 got data from pickerview. is there any possible my label get data from pickerview like i wrote above? or must i write my data at – (void)viewDidLoad ?

for any help, thank you for watching my question.

  • 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-06T06:05:37+00:00Added an answer on June 6, 2026 at 6:05 am

    In your program you are appending string to an integer that is the issue.
    This code makes the issue. Because year is an integer.

    labelDate1.text = [year stringByAppendingFormat:@" : %d : %d", month, day];
    

    Please check with this code.

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
    {
        int year = [picker selectedRowInComponent:0];
        int month = [picker selectedRowInComponent:1];
        int day = [picker selectedRowInComponent:2];
        NSString *date = @"";
        if(viewPicker.tag == 1)
            labelDate1.text = [date stringByAppendingFormat:@" %d : %d : %d",year, month, day];
        else
            labelDate2.text = [date stringByAppendingFormat:@"%d : %d : %d", year, month, day];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following: - (NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 2; } - (NSInteger)
I have two columns pickerView. In first column i have units like km, feet.
i have added a pickerview from interface builder.i am using this method to show
I have four NSDictionaries that I would like to use to populate a pickerview
Have UIPickerView with two rows. Trying to save value of each row in NSUserDefaults
I Create a class named DataClass there i have this method +(NSMutableArray*) returnList :(NSString
I want to use UIPickerView with 2 components, in which the second component value
I got problems with reload component in UIPickerView. Here is my code: on my
I have a picker view,when the row component of a picker view is selected,it
I have a very simple application that use a 2 component UIPickerView that causes

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.