0

我使用以下代码作为 infolight 按钮(感谢 https://stackoverflow.com/users/630145/ankit-bhardwaj

// This will create ur info button in center.
    UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
    UIBarButtonItem *infoButtonItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
    [infoButton addTarget:self action:@selector(goToRechercherView) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *flexibleLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    toolBar.items = [NSArray arrayWithObjects:flexibleLeft,infoButtonItem,flexibleLeft, nil];

这是动画,我得到了它如何翻转但翻转到同一页面的部分。

//This is for swipe animation. add your view inside.
-(void)goToRechercherView{
    [UIView beginAnimations:@"flipview" context:nil];
    [UIView setAnimationDuration:1];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
                           forView:self.view cache:YES];
    [UIView commitAnimations];

所以我已经将flipviewcontroller.h .m .xib 文件添加到项目中,我想在flipanimation 中打开那个xib/页面。

有人建议我的方法。

4

3 回答 3

0

试试这个代码可能对你有帮助

-(void)goToRechercherView{

      RechercherView *info3 = [[RechercherView alloc]initWithNibName:@"RechercherView" bundle:nil];
        UINavigationController * nvc = [[UINavigationController alloc] initWithRootViewController:info3];

        info3.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self.navigationController presentModalViewController:nvc animated:YES];

//  if you using latest Version of iOS Just Change the following

  [self.navigationController presentViewController:nvc animated:YES completion:nil];

    }
于 2012-12-24T13:44:09.213 回答
0

有两种方法可以做到这一点...

第一个是……

newView setFrame:CGRectMake( 0.0f, 480.0f, 320.0f, 480.0f)]; //notice this is OFF screen!
[UIView beginAnimations:@"animateView" context:nil];
[UIView setAnimationDuration:0.4];
[newView setFrame:CGRectMake( 0.0f, 0.0f, 320.0f, 480.0f)]; //notice this is ON screen!
[UIView commitAnimations];

第二种选择是使用内置动画作为翻转和卷曲:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                           forView:newView
                            cache:YES];

[self.navigationController.view addSubview:settingsView.view];
[UIView commitAnimations];
于 2013-03-04T13:19:08.150 回答
0

如果您不介意新的视图控制器在演示期间从右侧而不是左侧翻转,我建议您以模态方式演示新的控制器。这很简单:

UIViewController *mySecondViewController = [[self storyboard] instantiateViewControllerWithIdentifier:@"someID"];
[mySecondViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:mySecondViewController animated:YES completion:nil];
于 2012-12-24T13:02:08.663 回答