我在嘗試使UITabBarViewController執行與UINavigationController執行pushViewController時相同的動畫時遇到了問題。切換標籤時在UITabController中的標籤之間切換時使用'pushViewController'動畫
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
UIViewController *currentVC = [tabBarController selectedViewController];
if (currentVC == viewController)
return NO;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
UIModalTransitionStyle transition = UIModalTransitionStyleFlipHorizontal;
[UIView setAnimationTransition:transition forView:tabBarController.view cache:YES];
[currentVC viewWillAppear:YES];
[viewController viewWillDisappear:YES];
[viewController viewDidDisappear:YES];
[currentVC viewDidAppear:YES];
[UIView commitAnimations];
return YES;}
下面的代碼執行的動畫:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
UIViewController *currentVC = [tabBarController selectedViewController];
if (currentVC == viewController)
return NO;
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:tabBarController.view cache:YES];
[currentVC viewWillAppear:YES];
[viewController viewWillDisappear:YES];
[viewController viewDidDisappear:YES];
[currentVC viewDidAppear:YES];
[UIView commitAnimations];
return YES;}
如何修改上面的代碼,以執行從右側動畫類似於推一個的viewController到導航控制器滑動?
嘗試了他們給出的例子,但它沒有奏效。也許它適用於較舊的SDK版本。 – sonics876 2011-04-19 21:19:34