我为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];所以我在项目中添加了FlipviewControler.h .m .xib文件,我想在flipanimation中打开那个xib/页面。
有人向我提出了解决这个问题的方法。
发布于 2012-12-24 21:02:09
如果你不介意新的视图控制器在演示过程中从右边而不是左边翻转,我建议你以模态的方式展示新的控制器。它很简单,就像:
UIViewController *mySecondViewController = [[self storyboard] instantiateViewControllerWithIdentifier:@"someID"];
[mySecondViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:mySecondViewController animated:YES completion:nil];发布于 2012-12-24 21:44:09
尝试此代码可能会对您有所帮助
-(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];
}发布于 2013-03-04 21:19:08
有两种方法可以做到这一点。
第一个是......
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];https://stackoverflow.com/questions/14021716
复制相似问题