控制視圖切換方向

1. 若是用presentModalViewController, 能夠這樣作:動畫


Objective-Curl

1spa

2ip

3animation

4it

5io

6table

- (IBAction)infoButtonPressed:(id)sender {function

InfoViewController *infoViewController = [[InfoViewController alloc] initWithNibName: @"DAandPAInfo" bundle: [NSBundle mainBundle]];import

self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController: infoViewController animated: YES];

[infoViewController release];

}


2. 若是是pushViewController, 則複雜一點


CATransition *transition = [CATransition animation];

transition.duration = 1.0f;/* 間隔時間*/

transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];/* 動畫的開始與結束的快慢*/

transition.type = @"reveal";/* 各類動畫效果*/

//@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip" @「twist」

transition.subtype = kCATransitionFromTop;/* 動畫方向*/

//各類動畫效果

/*

kCATransitionFade;

kCATransitionMoveIn;

kCATransitionPush;

kCATransitionReveal;

*/

/*

kCATransitionFromRight;

kCATransitionFromLeft;

kCATransitionFromTop;

kCATransitionFromBottom;

*/

transition.delegate = self;

[self.navigationController.view.layer addAnimation:transition forKey:nil];

TestViewController *next = [[TestViewController alloc] init];

[self.navigationController pushViewController: next animated:NO];

相關文章
相關標籤/搜索