0

我有一个button加载viewcontroller一个motherViewController. 这似乎工作正常,但由于某种原因,新引入view的内容太高以至于底部的内容被裁剪。

- (IBAction)LoginButton:(UIButton *)sender
{
        FirstViewController *FirstView = [self.storyboard instantiateViewControllerWithIdentifier:@"First"];
        SecondViewController *SecondView = [self.storyboard instantiateViewControllerWithIdentifier:@"Second"];
        ThirdViewController *ThirdView = [self.storyboard instantiateViewControllerWithIdentifier:@"Third"];
        FourthViewController *FourthView = [self.storyboard instantiateViewControllerWithIdentifier:@"Fourth"];
        FifthViewController *FifthView = [self.storyboard instantiateViewControllerWithIdentifier:@"Fifth"];

        FirstView.Username = self.UsernameBox.text;

        UINavigationController *FirstNavController = [[UINavigationController alloc]init];
        [FirstNavController pushViewController:FirstView animated:NO];

        UINavigationController *SecondNavController = [[UINavigationController alloc]init];
        [SecondNavController pushViewController:SecondView animated:NO];

        UINavigationController *ThirdNavController = [[UINavigationController alloc]init];
        [ThirdNavController pushViewController:ThirdView animated:NO];

        UINavigationController *FourthNavController = [[UINavigationController alloc]init];
        [FourthNavController pushViewController:FourthView animated:NO];

        UINavigationController *FifthNavController = [[UINavigationController alloc]init];
        [FifthNavController pushViewController:FifthView animated:NO];


        tabBar = [[UITabBarController alloc]init];    
        tabBar.viewControllers = [NSArray arrayWithObjects:FirstView, SecondView, ThirdView, FourthView, FifthView, nil];
        [self.view addSubview:tabBar.view];

}

视图控制器

4

2 回答 2

1

我不知道我是否正确。但这是答案,您正在尝试添加UIViewController (UITabbarController)到您的ViewController. 所以你需要把它放在你的view,例如

tabbar.view.frame = CGRectMake(0, 0, 320, 460);

但唯一我不知道它是如何完美定位的,当我们添加到window. 通过设置frame您的tabbarcontroller.

于 2012-12-26T12:34:48.220 回答
0

试试这个 -

 tabBar.tabBar.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin;
于 2012-12-26T12:31:29.360 回答