我在按钮单击时向我的视图添加了视图动画,第一次单击时视图将滑动到右侧,第二次单击时将返回..(就像在 Facebook iPhone 应用程序中一样)
但是动画不是那么流畅,有一些抽搐和所有。但是当它到达最终(x,y)时,它们处于正确的位置,当视图移动时,动画看起来并不那么专业。帮我纠正这个
还有一个问题,有没有办法用相同的事件为下面的标签栏设置动画。(您可以在图像中看到标签栏没有随动画一起移动)
在此处添加代码!
- (IBAction)ShowView:(id)sender
{
if (n==0)
{
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromLeft];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
self.view.center = CGPointMake(410, 205);
[[self.view layer] addAnimation:animation forKey:@"SwitchToNoti"];
n=1;
}else
{
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
self.view.center = CGPointMake(160,205);
[[self.view layer] addAnimation:animation forKey:@"SwitchTohome"];
n=0;
}