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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:52:58+00:00 2026-06-07T19:52:58+00:00

is is possible to access objects using variables in a FOR statement? Say i

  • 0

is is possible to access objects using variables in a FOR statement?

Say i have declared:

UIImageView *UIImageView0;
UIImageView *UIImageView1;
UIImageView *UIImageView2;

and i have 3 objects in an array and i call a FOR statement if x in the array is equal to 2 i want it to add the value of x to the UIImageView name like UIImageView1 etc

I have tried:

for (int x=0; x<[theArray count]; x++) {

UIImageView[x].image = etc....

}

but it gives me a error on UIImageView[x]

subscript requires size of interface 'UIImageView'

any ideas? or is it even possible with a UIImageView?

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-07T19:53:00+00:00Added an answer on June 7, 2026 at 7:53 pm

    You don’t have three elements in an array, though; you have three independent variables with similar names. If you created an actual array, containing the values of the three variables, then you could use the for loop — and in fact, the syntax would be just as you’ve shown (using the actual name of the array variable, of course.)

    You could say

    UIImageView * views[3] = {UIImageView0, UIImageView1, UIImageView2};
    

    and then use, for example, views[i].image in your loop.

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

Sidebar

Related Questions

I'm wondering if it's possible to access page JavaScript variables with Selenium. I have
Is it possible to access an object's private variables using an extension method?
Is it possible to access the properties of objects in xCode console? If I
Possible Duplicate: C++ delete - It deletes my objects but I can still access
Possible Duplicate: javascript object, access variable property name? I'm trying to call a method
Is it possible to access classes/objects reffered as self , static and $this in
Possible Duplicate: What is the correct way of using extern for global variables ?
Possible Duplicate: Is it possible to pass parameters by reference using call_user_func_array()? I have
Is it possible to access the 'notes' field of an object through the Maya
is it possible to access a static property of a COM object without creating

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.