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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:20:41+00:00 2026-06-09T01:20:41+00:00

Im having difficulty in understanding how the pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)rowinComponent:(NSInteger)component works Ive set up

  • 0

Im having difficulty in understanding how the pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)rowinComponent:(NSInteger)component works

Ive set up my picker ok, got my NSArray to populate it, what im trying to do is display an image from a selected row. I tried:

  - (void)viewDidLoad
{


////arrays & objects
arrStatus = [[NSArray alloc] initWithObjects:@"Appstorelogo",@"app",nil];
   //number of colums and rows etc of picker
 }
  -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
 //One column
return 1;
 }

-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:   (NSInteger)component
{
//set number of rows
return arrStatus.count;


 }

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row f orComponent:(NSInteger)component
 {
//set item per row
return [arrStatus objectAtIndex:row];

}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)rowinComponent:  (NSInteger)component

{


  [imageview setImage:[arrStatus objectAtIndex:row]];

}

but i get an error telling me “row” is undeclared? here: [imageview setImage:[arrStatus objectAtIndex:row]];

  • 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-09T01:20:43+00:00Added an answer on June 9, 2026 at 1:20 am

    It looks as if your delegate method is wrong.

    what you have:

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)rowinComponent:  (NSInteger)component {
    

    What it should be:

    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    

    Notice there is a space between (NSInteger)row and inComponent. This is important because row is the local variable’s name and not part of the method’s name.

    ALSO

    It seems as you have populated that array with strings, not images. I would suggest creating two UIImages and putting them in the array if you are hoping to have the [imageview setImage:..]; method working correctly.

    To create a UIImage with an image located within your Application Bundle, use this syntax:

    UIImage *image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AppleStoreLogo" ofType:@"jpg"]];
    

    **Note Be sure you’ve added the image to your application bundle properly. To do so, first place the image with the app’s folder somewhere. Next click and drag that image over in to XCode into resources. XCode will ask you if you want to add the image to the bundle, select Yes. That’s it 🙂

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

Sidebar

Related Questions

I'm having difficulty understanding how 'static' stuff works in PHP. Can someone point me
I'm having difficulty understanding variable shadowing in JavaScript based on scopes. Consider this small
I am having difficulty understanding the part value : value == 0 ? How
So I am new to C# and I am having difficulty understanding out .
So I'm new to regular expressions and having difficulty understanding them. To get my
I was going through an interview question on JavaRevisited and I'm having difficulty understanding
I am new to programming and am having difficulty with understanding object lifetime /
I'm working on an ASP.NET application and I'm having difficulty in understanding why a
I'm having a little difficulty understanding alias_method / alias_method_chain . I have the following
I've been having some difficulty in understanding the source of a problem. Below is

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.