Reputation: 2611
Im using this code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(_shrinkDidEnd:finished:contextInfo:)];
tblSimpleTable.frame = tableFrame;
messegeField.frame = messegeFrame;
[UIView commitAnimations];
Where messegeFrame and tableFrame are the new frames of this views. I hoped that this would of made the table and the messege field move together, but first the table moves and only then the messege field. Is there anyway of making them move together?
notice: the thing is that both of them are resizing but not in the same time
Upvotes: 0
Views: 274
Reputation: 301
Try setting a timer on the animation, I have moved dozens of views simultaneously and this is the notable absence in your code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(_shrinkDidEnd:finished:contextInfo:)];
tblSimpleTable.frame = tableFrame;
messegeField.frame = messegeFrame;
[UIView commitAnimations];
I would also not that I have not used the setAnimationDidStopSelector, so if that is your problem you can call the end of the animation with a NSTimer set to the same time length as the animation.
Upvotes: 1
Reputation: 2720
As face value this code looks ok and I have used this method to translate more than 1 object at once before.
IF you are just moving those 2 objects, there are alternatives you could try: UIOBJECT.center
- although this indirectly affects the frame. Or overkill with a CGAffineTransformTranslate
.
Upvotes: 0