...
(必要が< QuartzCore/QuartzCore.h>)
右から左へのビューをスライドカスタム関数をだ
- (void)switchTwoViews:(UIView *)view1 otherView:(UIView *)view2 direction:(int)directionRL{
view2.bounds = CGRectMake(0, 0, 480, 320);
visibleView = view2;
// remove the current view and replace with view1
[view1 removeFromSuperview];
[currentOptionsView addSubview:view2];
// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
if (directionRL == 0) {
[animation setSubtype:kCATransitionFromRight];
} else {
[animation setSubtype:kCATransitionFromLeft];
}
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[currentOptionsView layer] addAnimation:animation forKey:@"SwitchToView"];
}
(方向= 0 )、またはその逆(direction = 1)である。
お試しください。楽しい。
こんにちは、この問題に直面して、私の2番目のビューを最初のビューにスライドさせることができません! 現在:左から右へスライド(行くfwd) 私が必要なもの:右から左へスライド –