我正在做一个项目,其中第一个视图不应该包含任何选项卡栏,当视图被按下时,它应该作为翻页移动。然后,从下一页开始,应显示选项卡栏项目。如果我是正确的,我认为tabbarcontroller不会帮助我实现上述目标。所以我添加了一个tabbar元素。而是如何将按钮动作赋予tabbar元素中的选项卡栏项目,以便在按下tabbar按钮时加载每个视图作为tabbar控制器的视图。任何帮助都是非常感谢的。谢谢
发布于 2012-03-17 12:35:27
为了翻转视图,实现这个..
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.80];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:self.detailviewcontyrollerObj animated:YES];
[UIView commitAnimations];你想要第二个视图中的标签栏,所以在第一个视图中,点击一个按钮(或其他任何东西),编写代码来调用应用程序委托中的函数。
-(IBAction)clickme
{
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication]delegate];
[app SwitchToTabbarController];
}现在,在app委托中,声明名为SwitchToTabbarController的方法,在该方法中实现这..
_tabBarController = [[UITabBarController alloc] init];
FirstViewController *view1 = [[FirstViewController alloc] init];
SecondViewController *view2 = [[SecondViewController alloc]init];
UINavigationController *tbl1=[[[UINavigationController alloc] initWithRootViewController:view1] autorelease];
tbl1.navigationBar.barStyle = UIBarStyleBlackOpaque;
tbl1.navigationBarHidden=NO;
UINavigationController *tbl2=[[[UINavigationController alloc] initWithRootViewController:view2] autorelease];
tbl2.navigationBar.barStyle = UIBarStyleBlackOpaque;
tbl2.navigationBarHidden=NO;
_tabBarController.viewControllers = [NSArray arrayWithObjects:tbl1,tbl2,nil];
[_window addSubview:_tabBarController.view];
self.window.rootViewController = self.tabBarController;
[_window makeKeyAndVisible]; 整体实现将非常有帮助,我认为这就是您想要的....:)
https://stackoverflow.com/questions/9747016
复制相似问题