使用iOS 5中的addChildViewController在Tabbar底部实现菜单栏

时间:2013-05-31 10:01:26

标签: iphone objective-c ios5 uiviewcontroller

我正在使用屏幕底部有自定义菜单的应用程序(如Tabbar)。自定义菜单将显示在所有UIViewController中。

例如:我底部有6个菜单按钮。当我点击Button1时,我可以看到自定义菜单上方的UIViewController1UIViewController1UITableView,将显示列表。当我点击didSelectRowAtIndexPath UIViewController2时,我会点击导航。

如何使用addChildViewController实现此目的。 ?

我已经推荐了this link,但没有通过我的不同UIViewController获得成功。

1 个答案:

答案 0 :(得分:0)

It is very simple u can do it in multiple ways one way is to add navigation controller to root view controller and then push all the views one by one according to requirement.

Your you can addview also like this

 SecondView * myModalVC = [[SecondView alloc] init];
/*
    [myModalVC setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    [self presentViewController:myModalVC animated:YES completion:NULL];

 */

/*
[UIView transitionWithView:self.view duration:3.0 options:UIViewAnimationOptionTransitionCurlUp animations:^{[self.view addSubview:myModalVC.view];} completion:NULL];


    */
    CATransition *transition = [CATransition animation];
    transition.duration = 1.25;
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromRight; //choose your animation
    [transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];

    [myModalVC.view.layer addAnimation:transition forKey:nil];


      [self presentViewController:myModalVC animated:NO completion:NULL];

   // [self transitionFromViewController:self toViewController:myModalVC duration:2.0 options:UIViewAnimationOptionTransitionNone animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>]

你喜欢的东西可以简单使用:)