views:

480

answers:

1

Hi,

I want to add multiple objects of UIImageView at run time. I just read that its possible through NSMutableArray.

But I also want to move that all objects of the UIImageView. Is it possible to track, on which UIImageView's object I touched?

Please help me. Any type of help will be accepted.

Thanks

+1  A: 

You may need to rephrase your question but I'll see if I can help you out. To find what view is being touched, you can define the touchesBegan method in your view controller.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    UITouch *touch = [[event allTouches] anyObject]; //gets the touch object
    [touch.view thisIsAMethod]; 
    //once you declare touch, you can access what view is being touched with touch.view

}

Also, if you want to move a lot of UIImageViews at once, you can make them all subviews of one UIView by calling

[oneBigUIView addSubview:oneUIImageView];

for every UIImageView. Then you can change the position of the UIView to move them all at once, since the coordinates of each UIImageView are in relation to their superview.

Tozar