I have 2 views which are the same size, with colourPreview set as a subview of self.view. This is my code for showing the animation:
-(void)startEditingHexLabel {
[UIView animateWithDuration:0.3
animations:^{
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:hexTextView cache:YES];
[colourPreview removeFromSuperview];
[self.view addSubview:hexTextView];
[self.view sendSubviewToBack:colourPreview];
}
completion:^(BOOL finished){
[hexText becomeFirstResponder];
}];
}
But it just changes to the new view witho开发者_JS百科ut a transition. Any ideas?
Have you tried using transitionWithView:duration:options:animations:completion:
(docs here). Seems this is preferred in iOS 4.0+. There's an example of how to use it in those docs.
If you want to use your current method, I think forView
in [UIView setAnimationTransition:forView:cache:]
needs to be the superview of the views you want to animate. In your case, this looks to be self.view. Full docs here.
HTH
精彩评论