I have a view with about 10 objects on it, and I have set all individual tags for them. I would like to move them all up by 20 points so their original Y position minus 20, using a for loop and iterating through each tag. I know I can do something like
[self.view viewWithTag:i].frame = CGRectMake(X, Y-20, W, H);;
but that requires me to give an X, Y, Width, and Height. So my question is, how can I find the original coordinates for all the objects and set the X, W, and H to the original and only move Y up?
Any tips would be greatly appreciated.
Thanks
Simply base the view's new frame on its current one:
UIView* view = [self.view viewWithTag:i];
CGRect frame = view.frame;
frame.origin.y -= 20;
view.frame = frame;