Non sono sicuro del motivo per cui le persone suggeriscono di utilizzare una traduzione. Se tutto ciò che devi fare è far scorrere le immagini, chiama semplicemente -setCenter su ogni immagine vista all'interno di un blocco di animazione. Come questo:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[leftCurtainImageView setCenter:pointOffScreenLeft];
[rightCurtainImageView setCenter:pointOffScreenRight];
[UIView commitAnimations];
Dove pointOffScreenLeft e pointOffScreenRight sono calcolati simile:
CGPoint pointOffScreenLeft = CGPointMake(
-[leftCurtainImageView bounds].size.width,
[leftCurtainImageView frame].origin.y);
CGPoint pointOffScreenRight = CGPointMake(
[rightCurtainImageView frame].origin.x +
[rightCurtainImageView bounds].size.width,
[leftCurtainImageView frame].origin.y);
Questi calcoli presuppongono che le tende sono posizionati ai bordi estrema sinistra e di estrema destra rispettivamente della loro vista contenente.
fonte
2010-08-26 17:02:43