我正在制作一个带有弹出效果的小视图以提醒您错误...动画效果很好但仍然不是很满意,因为我希望视图不会停在位置(x 25)但是我希望他们来到(x 40)然后立即回到(x 25)。换句话说,当你错误插入用户访问操作系统的字段时,我想重新创建他们对文本域MontainLion的影响......
我真的希望能够向我解释,但如果我没有成功请告诉我,以便我能更好地解释这个问题。谢谢大家!罗里。
下面我将向您展示显示我正在使用的弹出窗口的代码
- (Void)presentazioneViewTransition
{
CGRect endREct ;
endREct = CGRectMake (25, 160, 270, 90);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.25];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(endRightAnimation)];
self.frame = endREct;
[UIView commitAnimations];
}
答案 0 :(得分:1)
您可以使用基于简单块的UIView动画方法,例如
-(void)presentazioneViewTransition{
CGRect transitionRect = CGRectMake(40.0f, 160.0f, 270.0f, 90.0f);
CGRect endREct = CGRectMake (25.0f, 160.0f, 270.0f, 90.0f) ;
[UIView animateWithDuration:0.15f
animations:^{
self.frame = transitionRect;
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.1f
animations:^{
self.frame = endREct;
}];
}];
}