I’m writing an app for iOS6, using the Interface Builder, that displays text (from an array of texts) in a UITextView on top of a UIImageView. The user can swipe right or left to change to another text in the array.
Right now I’m using the following code:
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype =kCATransitionFromRight;
transition.delegate = self;
[self.view.layer addAnimation:transition forKey:nil];
[self.view addSubview:self.text];
and the entire screen is animated when the user swipes, UITextView, UIImageView, and all. How can I make only the text move left and right when the user swipes but leave the UIImageView in place?
Add animation with UITextview’s layer.
[YourTextView.layer addAnimation:transition forKey:nil];