ios控制视图切换方向

郏佐
2023-12-01

1. 如果用presentModalViewController,可以这样做:


- (IBAction)infoButtonPressed:(id)sender {

InfoViewController *infoViewController = [[InfoViewControlleralloc] initWithNibName: @"DAandPAInfo" bundle: [NSBundlemainBundle]];

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;

   //各种动画效果

   

   

   

  transition.delegate self;

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

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

  [self.navigationController pushViewController:next animated:NO];
 类似资料: