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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:17:27+00:00 2026-06-06T11:17:27+00:00

I am trying to reset the UIPickerView on button click. My pickerview id is

  • 0

I am trying to reset the UIPickerView on button click.
My pickerview id is created at runtime, I have delegates set already.
After googling, I found

[pickerView reloadAllComponents];

But this makes my app crash everytime it reaches here.

Object at index 0 is “Select from list” and then the items.
When the submit button is clicked, I want that the “Select from list” should remain at the top of my label (selected index: 0).

Here is my code

ViewDidload

 pickerView = [[UIPickerView alloc] init];
    pickerView.delegate = self;
    pickerView.dataSource = self;

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


 // Total rows in our component.
    -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
        return [nameArray count];
    }

// Display each row's data.
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
    return [nameArray objectAtIndex: row];
    }

// Do something with the selected row.

    -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
        dlbl.hidden=YES;
        NSLog(@"You selected this: %@", [nameArray objectAtIndex: row]);
        [btnSelectDesigner setTitle:[nameArray objectAtIndex: row] forState:UIControlStateNormal]; 

    }

and, on button click:

-(IBAction)btnSubmitClicked:(id)sender{
[pickerView reloadAllComponents];
}

Any idea what I’m doing wrong?

Thanks

  • 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-06T11:17:29+00:00Added an answer on June 6, 2026 at 11:17 am
    [picker reloadAllComponents];
    [picker selectRow:0 inComponent:0 animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m trying write code that after reset set up rrpmax as 3000. It
I'm trying to reset the Background property of a button after I change it
I'm trying to select all input elements except input type=submit/reset/button I have tried to
I am trying to reset some css but with a delay after the click.
I am trying to reset data in a stacked chart on a button click
I have 2 dropdown lists on my webform and using jquery trying to filter/reset
I'm trying to use the form_for reset button: <%= button_tag 'Reset', :type => 'reset'
I am trying to reset a class for any links that have been previously
I'm trying to reset the CSS position of an element after it's been animated,
I have a form that im working on, im trying to reset a field

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.