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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:34:05+00:00 2026-06-14T20:34:05+00:00

I have been working on the app, that has 3 uipickers. I want to

  • 0

I have been working on the app, that has 3 uipickers. I want to implement images in each uipicker. However as seen in the image attached below, it just affects only one uipicker, not all of them.I would like to know how I could able to custom all uipicker elements shown in the imageenter image description here

 - (void)loadView
    {
        picker1 = [[UIPickerView alloc] initWithFrame:CGRectMake(30, 200, 250, 250)];
        picker1.delegate = self;
        picker1.dataSource = self;
        picker1.showsSelectionIndicator = YES;
        picker1.tag=1;


        picker2 = [[UIPickerView alloc] initWithFrame:CGRectMake(390, 200, 250, 250)];
        picker2.delegate = self;
        picker2.dataSource = self;
        picker2.showsSelectionIndicator = YES;
        picker2.tag=2;



        picker3 = [[UIPickerView alloc] initWithFrame:CGRectMake(750, 200, 250, 250)];
        picker3.delegate = self;
        picker3.dataSource = self;
        picker3.showsSelectionIndicator = YES;
        picker3.tag=3;


        self.view = [[UIView alloc] initWithFrame:CGRectZero];
        self.view.backgroundColor=[UIColor whiteColor];

        [self.view addSubview:picker1];
        [self.view addSubview:picker2];
        [self.view addSubview:picker3];


        UIImage *seven = [UIImage imageNamed:@"seven.png"];
        UIImage *bar = [UIImage imageNamed:@"bar.png"];


        for(int i=1; i<=4; i++)
        {
            UIImageView *sevenView = [[UIImageView alloc] initWithImage:seven];
            UIImageView *barView = [[UIImageView alloc] initWithImage:bar];


            NSArray *imageViewArray = [[NSArray alloc] initWithObjects:
                                       sevenView,barView,nil];

            NSString *fieldName = [[NSString alloc] initWithFormat:@"column%d",i];
            [self setValue:imageViewArray forKey:fieldName];
        }

    }


    -(UIView *)pickerView:(UIPickerView *)pickerView
               viewForRow:(NSInteger)row
             forComponent:(NSInteger)component reusingView:(UIView *)view
    {
        //NSLog(@"%d",component);
        NSLog(@"tag: %d",pickerView.tag);

        if(pickerView.tag==1)
        {   NSString *arrayName = [[NSString alloc] initWithFormat:@"column%d",component+1];
            NSArray *array1 = [self valueForKey:arrayName];
            return [array1 objectAtIndex:row];
        }
        else if(pickerView.tag==2)
        {   NSString *arrayName = [[NSString alloc] initWithFormat:@"column%d",component+1];
            NSArray *array2 = [self valueForKey:arrayName];
            return [array2 objectAtIndex:row];
        }
        else
        {   NSString *arrayName = [[NSString alloc] initWithFormat:@"column%d",component+1];
            NSArray *array3 = [self valueForKey:arrayName];
            return [array3 objectAtIndex:row];
        }

    }

    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
        // Release anything that's not essential, such as cached data
    }


    - (void)dealloc {

    }

    #pragma mark UIPickerViewDelegate methods

    - (NSString*)pickerView:(UIPickerView*)pv titleForRow:(NSInteger)row forComponent:(NSInteger)component
    {
        return [NSString stringWithFormat:@"%d",row];
    }

    #pragma mark UIPickerViewDataSource methods

    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView*)pv
    {
        return 4;
    }


    - (NSInteger)pickerView:(UIPickerView*)pv numberOfRowsInComponent:(NSInteger)component
    {
        return 2;
    }

    @end
  • 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-14T20:34:06+00:00Added an answer on June 14, 2026 at 8:34 pm

    Views can only have one parent. But you are trying to use each view for 3 parents (the 3 pickers). Regardless of the picker, you try to use the same set of image views for component X of each picker. That won’t work.

    You need three sets of arrays, not just the one set. In other words, you can’t share views between the pickers.

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

Sidebar

Related Questions

I have been working on an iPhone app that has a feature of uploading
I have a very strange error happening in an App that has been working
I have an App that has been working and selling in the App store
We have a C# app that has been working on three machines, 2 running
I have been working with a Windows Mobile 6 app that is built with
A medium sized rails app that our company has been working on is getting
I have been working on a Core Data iOS app that works perfectly through
I am working on a web app project that has been in development for
I have an app that I have been working with for over a year,
I've got an app that has been working well for a long time. I'm

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.