通过改变其高度和位置来制作UIView的动画。第一个动画跳了吗?我将故事板中设置的UIView(theView)的大小设置为216的高度。因此应用程序加载并显示theView。我点击View,它会快速跳到200+像素,然后按照它应该动画?
- (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");
}];
}
}];
}
答案 0 :(得分:0)
尝试移动线
CGRect theFrame = self.theView.frame;
theFrame.size.height += 100.f; <!-- when it hits here the view jumps then animates
在街区之外。在调用动画方法之前把它放。