Hy community ,
i am adding
UIImageViews´s to a view in runtime like this.
Code:
UIImageView *temImageView = [[UIImageView alloc] initWithFrame:CGRectMake(160, 240, 100, 100)];
temImageView.image = [previewImagesListFlowers objectAtIndex:indexPath.row];
[newCardController.view addSubview:temImageView];
This works so far, but i want to move this images in the touch methods.
how can i access this UIImageview´s in the touch methods?
i try this:
Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
currentImageView = (UIImageView *)[touch view];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (CGRectContainsPoint([currentImageView frame], [[allTouches objectAtIndex:0] locationInView:self.view])) {
currentImageView.center = [[allTouches objectAtIndex:0] locationInView:myView];
return;
}
if i touch the screen and move it moves the hole view, not the UIImageView on it.
has anyone a solution ?
I want to add UIimageView´s in runtime and move the around.
best regards
Erikson2000