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

  • Home
  • SEARCH
  • 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 6587305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:54:01+00:00 2026-05-25T16:54:01+00:00

Im using a uiPickerView that haves images instead of strings for the selections, is

  • 0

Im using a uiPickerView that haves images instead of strings for the selections, is working ok for showing the images, I got inspiration from the apple UIcatalog example on how to put the images,

Im implementing it programatically no IB,

So the question is, how to change an image according to the selected cell?

i have
* MainVC (my main view controller)
* CustomView (defining picker size)
* CustomPickerDataSource (the data source for the picker 🙂

in CustomPickerDataSource, send the data for wich row was selected

- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component {
// Handle the selection
NSLog(@"seleccionokkkk: %d", row);
[MainVC entro:row];
}

and in my MainVC

+(void) entro: (int) cuca {

NSLog(@"sumbalo :%d", cuca);
 }

I get the number of cell selected on my MainVC, which is where I want to show the different images,
but when selecting the image in my +(void) entro: (int) cuca
I get warnings of course as Im setting instance variables with a class method,

so how can I show the image according to which cell number I receive?

Pseudocode:
if image == 0, show image0

Where to put my image showing code?, and how to set the variable for the incoming message?

thanks a lot!

  • 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-25T16:54:01+00:00Added an answer on May 25, 2026 at 4:54 pm

    I’d assume you have as many images as you have items in the picker. Put them into an array in the same order as you did in the picker view. Then take the UIImageView that you want to change to the selected picture, and set it to the picture in the array with the given index.

    You can do this in your entro: method (which should be an instance method, no reason that it shouldn’t or can’t be), or you can just go ahead and do it in the pickerView:didSelectRow: method.

    You can set images like this:

    UIImageView *myImageView;
    NSArray *myImageArray;
    ...
    
    - (void)pickerView:(UIPickerView *)pickerView didSelectRow: 
    (NSInteger)row inComponent:(NSInteger)component {
        [myImageView setImage:[myImageArray objectAtIndex:row]];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a UIPickerView object that lists stores based on either a listed home
How to access(get the user selection) from UIpickerview components in different UIViews (NOT using
I'm using UIpickerview in my app. The problem is that my pickerview titleforrow function
I have two fields that call UIPickerView (Country and Province). I'm using inputView to
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I am currently using a UIPIckerView in my app to allow a user to
I am using UIPickerView with storyboard. When I link the Datasource and delegate of
Using mercurial, I've run into an odd problem where a line from one committer
I have a root UIViewController subclass that has a UITabBar, (I'm not using UITabBarController)
i need to refresh the data in the UIPickerView. i'm using [pickerView reloadAllComponents]; but

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.