2012-05-06 91 views
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]; 

但是這正常工作與縱向模式。

我想在橫向模式下實現它,在右上角和左下角錄音。

目前其工作效果相反。

非常感謝

+0

哦,親愛的...您似乎已將代碼格式化爲引號。 – CodaFi

+2

你是什麼意思「在右上角和左下角錄音」?而當你說它正在逆向工作時:與什麼相反? – EmilioPelaez

+0

目前,捲曲是從右上角下來的,相反,我需要從右下角,反之亦然。 – iscavengers

回答

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"; 
    [email protected]"fromRight"; 
    animation.fillMode = kCAFillModeForwards; 
    animation.endProgress = 1.0; //0.58; 
} 
else { 
    //previous animation 
    animation.type = @"pageCurl"; 
    [email protected]"fromLeft"; 
    animation.fillMode = kCAFillModeBackwards; 
    animation.startProgress = 0.0; 
} 
[animation setRemovedOnCompletion:NO]; 

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

[[view layer] addAnimation:animation forKey:@"pageCurlAnimation"]; 
} 
+0

感謝你的啓動和運行 – iscavengers

1

請,試試這個way.i一個查看

第一視圖中查看導航用來去旁邊Infoview中我創造了curlup效果:

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]; 

我希望這對你有所幫助。

+0

謝謝dev,感謝你的幫助。 – iscavengers