查看包含导航栏和标签栏移到一些4毫米向下

查看包含导航栏和标签栏移到一些4毫米向下

问题描述:

从登录屏幕要前往一类我的应用程序说CLASSA,这样查看包含导航栏和标签栏移到一些4毫米向下

classA *objUserHome = [[classA alloc]init]; 
     [self presentModalViewController:objUserHome animated:YES]; 
     [objUserHome release]; 

和ClassA的是有一个导航栏和的TabBar (在这5个选项卡),我创建了我的标签栏编程这样

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    //Create tab bar controller and navigation bar controller 

    tabBarController = [[UITabBarController alloc] init]; 

    NSMutableArray *arrControllers = [[NSMutableArray alloc] initWithCapacity:5]; 

    //Add PunchClock to tab View Controller 
    PunchClock* objPunchClock = [[PunchClock alloc] initWithTabBar]; 
    NavigationController = [[UINavigationController alloc] initWithRootViewController:objPunchClock]; 
    NavigationController.navigationBar.tintColor = [UIColor brownColor]; 
    [arrControllers addObject:NavigationController]; 
    [NavigationController release]; 
    [objPunchClock release]; 

    //Add Time_Sheet to tab View Controller 
    Time_Sheet* objTime_Sheet = [[Time_Sheet alloc] initWithTabBar]; 
    NavigationController = [[UINavigationController alloc] initWithRootViewController:objTime_Sheet]; 
    NavigationController.navigationBar.tintColor = [UIColor brownColor]; 
    [arrControllers addObject:NavigationController]; 
    [NavigationController release]; 
    [objTime_Sheet release]; 

    //Add PTO to tab View Controller 
    PTO* objPTO = [[PTO alloc] initWithTabBar]; 
    NavigationController = [[UINavigationController alloc] initWithRootViewController:objPTO]; 
    NavigationController.navigationBar.tintColor = [UIColor brownColor]; 
    [arrControllers addObject:NavigationController]; 
    [NavigationController release]; 
    [objPTO release]; 

    //Add PunchClock to tab View Controller 
    CrewPunch* objCrewPunch = [[CrewPunch alloc] initWithTabBar]; 
    NavigationController = [[UINavigationController alloc] initWithRootViewController:objCrewPunch]; 
    NavigationController.navigationBar.tintColor = [UIColor brownColor]; 
    [arrControllers addObject:NavigationController]; 
    [NavigationController release]; 
    [objCrewPunch release]; 

    //Add PunchClock to tab View Controller 
    Reports* objReports = [[Reports alloc] initWithTabBar]; 
    NavigationController = [[UINavigationController alloc] initWithRootViewController:objReports]; 
    NavigationController.navigationBar.tintColor = [UIColor brownColor]; 
    [arrControllers addObject:NavigationController]; 
    [NavigationController release]; 
    [objReports release]; 

    // Add this view controller array into the tab bar 

    //self .viewControllers = arrControllers; 
    tabBarController .viewControllers = arrControllers; 

    [arrControllers release]; 
    [self.view addSubview:[tabBarController view]]; 


} 

而且ClassA is inherited from UIViewController

现在的问题是,导航到CLASSA,鉴于CL的后assA向下移动约4mm like this为何如此?我该如何解决这个问题,请帮助我,提前thanx

+0

你使用界面生成器:

这可以通过使用可以预防吗? (对于视图,而不是特定的标签栏),因为视图可能设置得太小? – nbsp 2012-07-09 04:58:21

+0

@nbsp不,我没有使用XIB,编程方式我创建了视图 – Ravi 2012-07-09 05:04:23

长期研究后,我最后只由UINavigationController而不是UIViewControler

您可能已经在Interface Builder或XIB文件中选择了一些顶栏,并另外设置了导航栏。不要在XIB文件中选择任何顶部栏。

+0

不,我没有在XIB – Ravi 2012-07-09 05:33:59

尝试如下

[self.navigationController.view addSubview:[tabBarController view]]; 
+0

中做过它的给出一个空白屏幕,查看内容是隐形的 – Ravi 2012-07-09 05:33:40

继承类使用时可能会遇到2个或多个视图之间的故事板和Modal Transition修复了这个问题类似于上面的错误。

如果使用Modal TransitionViewControllerAViewControllerZ,然后从ViewControllerZ尝试Modal TransitionViewControllerA有时ViewControllerA的观点被小幅上推下车窗。

[self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; 

ViewControllerZ从事件回去ViewControllerAViewControllerZ

+0

你的开头段落很混乱 – thecoshman 2012-10-10 12:54:11