嗨我正在开发一个应用程序.在那个我做了一个视图的动画从左到右和从右到左移动并更改该视图中包含的标签的值.但是当我点击向左或向右按钮时该视图被删除新视图覆盖旧视图.所以我不想覆盖.我想添加新视图.我的代码是
-(void)centerAnimation1:(id)sender
{
UIView *currentView = daysview;
theWindow = daysview;
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
animation.delegate = self;
[animation setDuration:0.4];
[animation setType:kCATransitionMoveIn];
if(rhtolft)
{
[animation setSubtype:kCATransitionFromLeft];
}
else
{
[animation setSubtype:kCATransitionFromRight];
}
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
[currentView removeFromSuperview];
}
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
if(animate)
{
CATransition *animation = [CATransition animation];
animation.delegate = self;
[animation setDuration:0.4];
[animation setType:kCATransitionMoveIn];
if(rhtolft)
{
[animation setSubtype:kCATransitionFromLeft];
rhtolft=NO;
}
else
{
[animation …Run Code Online (Sandbox Code Playgroud)