我正在開發一個應用程序。在那裏我想使用下面的代碼從右向左移動uiview。如何使用CATransition將屏幕的uiview部分從右向左移動
-(void)centerAnimation1:(id)sender
{
theview=qstnview;
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]];
//[animation setanima]
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
[[theview layer] addAnimation:animation forKey:@"SwitchToView1"];
[qstnview 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 setSubtype:kCATransitionFromRight];
}
//[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
//[animation setanima]
[[theview layer] addAnimation:animation forKey:@"SwitchToView1"];
[self.view addSubview:qstnview];
}
}
但是這一個正在從右側最後一條邊的觀點向左side.But我需要的幀大小內移動only.I不需要從右側開始edge.So請告訴我如何做那個。
哎交配剛剛看到這個鏈接演示其顯示您的輸出,只是看到.. http://www.cocoacontrols.com/controls/iiviewdeckcontroller –