Note that there are some explanatory texts on larger screens.

plurals
  1. POcreating an infinite stack of UIImageviews in xcode
    text
    copied!<p>i am trying to create a stack of UIImageViews in my app where i can indefinitely touch the uiimageview move it around the screen and drop it anywhere and there would still be a representation of the UIImageview in the original location where i could go grab another uiimageview move it and so on.the way i was trying to solve this problem was to create a uiimageview in IB that would remain in its original location and each time a touch is detected on top of it create a new uiimageview in the same location that would be able to be moved. here is the code i have so far:</p> <pre><code>-(void)dispatchTouchEvent:(UIView *)theView toPosition:(CGPoint)position { switch (glyphActive) { case 1: UIImage *image = [UIImage imageNamed:@"1.png"]; onePieceCopy = [[UIImage alloc] initWithImage:image]; onePieceCopy.frame = CGRectMake(currentPos.x, currentPos.y, 75, 75); [self.view addSubview:image]; if (CGRectContainsPoint([onePiece frame], position)) { onePiece.center = position; [self bringSubviewToFront:onePiece]; } //[onePieceCopy release]; break; } } </code></pre> <p>however i am getting errors on this line:</p> <pre><code>UIImage *image = [UIImage imageNamed:@"1.png"]; </code></pre> <p>that says "expected expression before 'UIImage'". and another error here:</p> <pre><code>[self.view addSubview:image]; </code></pre> <p>that says " error: request for member 'view' in something not a structure or union"</p> <p>i'm fairly new to all this and im not sure what im doing wrong can anyone give me a hand?</p>
 

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