Tyring通过改变其高度和位置来动画UIView动画。第一个动画跳转?我有在故事板中设置的UIView(theView)的大小为216的高度。因此,应用程序加载并显示该视图。我点击该视图,它会立即跳到200+像素的高度,然后按照它应该的动画效果?动画UIView大小跳跃
- (void)singleTapAction:(UIGestureRecognizer *)singleTap {
UIView *view = singleTap.view;
[UIView animateWithDuration:1.2 delay:0 options:UIViewAnimationCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^{
CGRect theFrame = self.theView.frame;
theFrame.size.height += 100.f; <!-- when it hits here the view jumps then animates
self.theView.frame = theFrame;
}
completion:^(BOOL finished) {
if(finished){
[UIView animateWithDuration:1.2 delay:0 options:UIViewAnimationCurveLinear | UIViewAnimationOptionAllowUserInteraction animations:^{
CGRect theFrame = self.theView.frame;
theFrame.origin.y -= 100.f;
self.theView.frame = theFrame;
}
completion:^(BOOL finished) {
NSLog(@"animations complete");
}];
}
}];
}
不确定要理解你的问题。只是不,顺便说一句,你有UIView :: animate中的“自动反向”选项。 – Vinzius 2013-02-15 22:56:19
@Vinzius你是对的。 – jdog 2013-02-16 04:38:35