iPhone Pushing View Controller in a left direction

前端 未结 6 1596
耶瑟儿~
耶瑟儿~ 2020-12-05 12:07

I have an app that has a centre view with two views off to each side of it. I want to have two navigation bar buttons, left and right which push a new navigation controller

6条回答
  •  悲哀的现实
    2020-12-05 12:54

    I have done change animation direction when we push viewcontroller. you can change animation type here [animation setSubtype:kCATransitionFromRight];

     ViewController *elementController = [[ViewController alloc] init];
    
    // set the element for the controller
    ViewController.element = element;
    
    
    // push the element view controller onto the navigation stack to display it
    
    CATransition *animation = [CATransition animation];
    [[self navigationController] pushViewController:elementController animated:NO];
    [animation setDuration:0.45];
    [animation setType:kCATransitionPush];
    [animation setSubtype:kCATransitionFromRight];
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
    [[elementController.view layer] addAnimation:animation forKey:@"SwitchToView1"];
    
    [elementController release];
    

提交回复
热议问题