Note that there are some explanatory texts on larger screens.

plurals
  1. POcenter.x and center.y with array of uiimageviews?
    primarykey
    data
    text
    <p>So I created an <code>NSMutableArray</code> of <code>UIImageView</code> like this:</p> <pre><code>NSMutableArray* imageViewArray = [[NSMutableArray alloc] init]; for(int i = 0; i &lt; 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]]; } </code></pre> <p>The method "animationInit" is a method I created to init the UIImageView. Its implementation is this:</p> <pre><code>-(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; } </code></pre> <p>I am able to set the center of each UIImageView in the array using like this:</p> <pre><code>[imageViewArray objectAtIndex:Index] setCenter:CGPointMake(x, y)]; </code></pre> <p>Now I would like to do be able to modify the <code>x</code> and <code>y</code> points like I would with a normal <code>UIImageView</code>. An example: <code>UIImageView.center = CGPointMake(UIImageView.center.x + 5, UIImageView.center.y + 5);</code></p> <p>The problem here is I have no idea how to access the "UIImageView.center.x/y" within the array of <code>UIImageViews</code>. 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 <code>CGPoints</code> to hold the <code>x</code> and <code>y</code> of the <code>UIImageViews</code> in the array?</p> <p>When I try <code>[imageViewArray objectAtInded:Index].center.x</code>, I get the following error.</p> <blockquote> <p>Request for member 'center' in something no a structure or union</p> </blockquote> <p>Is there a solution or workaround?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload