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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:45:28+00:00 2026-05-28T15:45:28+00:00

Using a segment control I’m trying to reload 2 UIPickerViews with a new array

  • 0

Using a segment control I’m trying to reload 2 UIPickerViews with a new array of data.

My problem is the new array doesn’t show until I scroll up or down on the picker (old data will go away once out of view). I’ve tried using the reloadAllComponents method to no luck. Here is what the code looks like:

//Segment Control
-(IBAction)unitType:(id)sender {
    if([sender selectedSegmentIndex]==0){
        NSLog(@"unitType change 1");
        NSLog(@"before values = %@",units);
        [units removeAllObjects];
        [units addObject:@"in"];
        //etc.
        [self.inputUnits reloadAllComponents];
        NSLog(@"current values = %@",units);
    }else {
        NSLog(@"unitType change 2");
        NSLog(@"before values = %@",units);
        [units removeAllObjects];
        [units addObject:@"in^3"];
        //etc.
        [self.inputUnits reloadAllComponents];
        NSLog(@"current values = %@",units);
    }
}

IB has 2 UIPickerViews wired up to the file’s owner for both delegate and datasource.

  • 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-28T15:45:29+00:00Added an answer on May 28, 2026 at 3:45 pm

    You haven’t hooked up the UIPickerView to your inputUnits property. Thus, your call to -reloadAllComponents is getting sent to nil, and things are only getting updated when the pickerView wants to show something new (which it does when you scroll).

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

Sidebar

Related Questions

I need to segment text using fullstops using PHP/Javascript.The problem is if I use
I am using a segment control. in that there are three segments..segment 1,segment 2,segment
I am trying to implement a 7-segment counter using VHDL. The counter starts from
I'm using a Segment to Segment closest approach method which will output the closest
I'm using Linq To Sql to fill up a listbox with Segment objects, where
On Linux I'm using shmget and shmat to setup a shared memory segment that
Using online interfaces to a version control system is a nice way to have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using Xcode 4.2 Storyboard, I've just created a segmented control in a view with

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.