views:

28

answers:

1

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:

-(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;
        }
}

however i am getting errors on this line:

UIImage *image = [UIImage imageNamed:@"1.png"];

that says "expected expression before 'UIImage'". and another error here:

[self.view addSubview:image];

that says " error: request for member 'view' in something not a structure or union"

i'm fairly new to all this and im not sure what im doing wrong can anyone give me a hand?

+1  A: 

well for one thing [self.view addSubview:image] should be [theView addSubview:image]

ennuikiller