首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >导航到flipview

导航到flipview
EN

Stack Overflow用户
提问于 2012-12-24 20:56:13
回答 3查看 121关注 0票数 0

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

代码语言:javascript
复制
// 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];

这是动画-,我知道它是如何翻转的,但它翻到了同一页。

代码语言:javascript
复制
//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];

所以我在项目中添加了FlipviewControler.h .m .xib文件,我想在flipanimation中打开那个xib/页面。

有人向我提出了解决这个问题的方法。

EN

回答 3

Stack Overflow用户

发布于 2012-12-24 21:02:09

如果你不介意新的视图控制器在演示过程中从右边而不是左边翻转,我建议你以模态的方式展示新的控制器。它很简单,就像:

代码语言:javascript
复制
UIViewController *mySecondViewController = [[self storyboard] instantiateViewControllerWithIdentifier:@"someID"];
[mySecondViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:mySecondViewController animated:YES completion:nil];
票数 0
EN

Stack Overflow用户

发布于 2012-12-24 21:44:09

尝试此代码可能会对您有所帮助

代码语言:javascript
复制
-(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];

    }
票数 0
EN

Stack Overflow用户

发布于 2013-03-04 21:19:08

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

第一个是......

代码语言:javascript
复制
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];

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

代码语言:javascript
复制
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                           forView:newView
                            cache:YES];

[self.navigationController.view addSubview:settingsView.view];
[UIView commitAnimations];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14021716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档