0

以下のコードスニペットを使用してカール効果を実装しようとしています

丸まる

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.95];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
 forView:self.view cache:YES];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];

くるくるする

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.95];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];

しかし、これはポートレートモードでうまく機能します。

右上と左下をテーピングして、ランドスケープモードで実装したいと思います。

現在、その逆効果で働いています。

どうもありがとう

4

2 に答える 2

2
#import <QuartzCore/QuartzCore.h>

-(void)pageCurltoNextorPrevious:(UIView*)view:(int)identifier {

// Curl the image up or down
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0];
CAMediaTimingFunction *fun=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[animation setTimingFunction:fun];


if (identifier==1){
    //next animation
    animation.type = @"pageCurl";
    animation.subtype=@"fromRight";
    animation.fillMode = kCAFillModeForwards;
    animation.endProgress = 1.0; //0.58;
} 
else {
    //previous animation
    animation.type = @"pageCurl";
    animation.subtype=@"fromLeft";
    animation.fillMode = kCAFillModeBackwards;
    animation.startProgress = 0.0;
}
[animation setRemovedOnCompletion:NO];

//[view exchangeSubviewAtIndex:0 withSubviewAtIndex:2];

[[view layer] addAnimation:animation forKey:@"pageCurlAnimation"];
}
于 2012-05-08T06:44:16.243 に答える
1

この方法を試してください.iは、ビューナビゲーションで1つのビューで使用されます

次の最初のビュー Infoview カールアップ効果を作成します。

InfoView *objdb=[[InfoView alloc] initWithNibName:@"InfoView" bundle:nil];
[UIView beginAnimations:nil context:NULL ];
[UIView setAnimationCurve:UIViewAnimationTransitionCurlUp];
[UIView setAnimationDuration:1.0];
[self presentModalViewController:objdb animated:YES];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[objdb release];

次に、infoview からメイン ビューに戻り、これを使用します (カール ダウン効果):

[UIView  beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationTransitionCurlDown];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.375];
[self dismissModalViewControllerAnimated:YES];
[UIView commitAnimations];

それがあなたの助けになることを願っています。

于 2012-05-10T06:11:59.727 に答える