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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:09:56+00:00 2026-05-26T07:09:56+00:00

So I created an NSMutableArray of UIImageView like this: NSMutableArray* imageViewArray = [[NSMutableArray alloc]

  • 0

So I created an NSMutableArray of UIImageView like this:

NSMutableArray* imageViewArray = [[NSMutableArray alloc] init];
for(int i = 0; i < 15; i++){
    UIImageView* imageView = [self animationInit:imageArray xPos:0 yPos:480 wFrame:32
                                                      hFrame:32 duration:0.5 repeat:0];
    [imageViewArray addObject:imageView];
    [imageView release];
    imageView = nil;
    [self.view addSubview:[imageViewArray objectAtIndex:i]];
}

The method “animationInit” is a method I created to init the UIImageView. Its implementation is this:

-(UIImageView*)animationInit:(NSArray*)imageArray xPos:(float)x yPos:(float)y wFrame:
                    (float)w hFrame:(float)h duration:(float)duration repeat:(float)count {
     UIImageView* imageAnimation = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
     imageAnimation.animationImages = imageArray;
     imageAnimation.animationDuration = duration;
     imageAnimation.animationRepeatCount = count;

     return imageAnimation;
 }

I am able to set the center of each UIImageView in the array using like this:

[imageViewArray objectAtIndex:Index] setCenter:CGPointMake(x, y)];

Now I would like to do be able to modify the x and y points like I would with a normal UIImageView. An example: UIImageView.center = CGPointMake(UIImageView.center.x + 5, UIImageView.center.y + 5);

The problem here is I have no idea how to access the “UIImageView.center.x/y” within the array of UIImageViews. Is there any way to access the “center.x/y” like I was able to with “setCenter:” or would I be better off creating a bunch of CGPoints to hold the x and y of the UIImageViews in the array?

When I try [imageViewArray objectAtInded:Index].center.x, I get the following error.

Request for member ‘center’ in something no a structure or union

Is there a solution or workaround?

  • 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-26T07:09:57+00:00Added an answer on May 26, 2026 at 7:09 am

    In order to access the x and y values of an array of UIImageViews you have to use the following.

    [imageViewArray objectAtIndex:Index] center].x
    

    With that, I was able to use the following.

    UIImageView.center = CGPointMake(UIImageView.center.x + 5, UIImageView.center.y + 5);
    

    Like this:

    [[imageViewArray objectAtIndex:Index] setCenter:CGPointMake([imageViewArray objectAtIndex:Index] center].x + 5, [imageViewArray objectAtIndex:Index] center].y + 5)];
    

    Again sorry for the mess and any confusion I may have caused. I confused the heck out of myself with this one.

    (I found the solution and thought it best I share it just in case anyone else runs into the same problem.)

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

Sidebar

Related Questions

I've got an array of NSNumber objects created thusly: myArray = [[NSMutableArray alloc] initWithObjects:[NSNumber
Is it possible to store dynamically created UIViews into an NSMutableArray? This question suddenly
I created two UIImageView *image1 and *image2, after I created a NSMutableArray *arrayImage, now
I have an array that gets created from JSON. The array looks like this:
I created a structure like this typedef struct Node { NSString* Description; NSString* AE;
So I dynamically create 3 UIButtons (for now), with this loop: NSMutableArray *sites =
I try to access some values in a NSMutableArray I created, but I only
In my Iphone App I have created this query: SELECT * FROM visuel where
I am unable to release NSMutableArray that I created in a method. SqliteData *s
I have created an animation like [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @Actor.plist]; spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@Actor.pvr.ccz];

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.