gpt4 book ai didi

iphone - 包含导航栏和标签栏的 View 向下移动了大约 4mm

转载 作者:行者123 更新时间:2023-11-29 13:32:55 27 4
gpt4 key购买 nike

在我的应用程序中,我从登录屏幕导航到一个类 classA ,就像这样

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

ClassA 有一个导航栏和一个标签栏(里面有 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是继承自UIViewController

现在的问题是,在导航到 classA 之后,classA 的 View 向下移动了大约 4mm like this为什么会这样??我该如何解决这个问题,请提前帮助我,谢谢

最佳答案

在 2 个或更多 View 之间使用 Storyboard和Modal Transition 时,您可能会遇到与上述类似的错误。

如果您使用从 ViewControllerAViewControllerZModal Transition,然后尝试从 进行 Modal Transition ViewControllerZ 回到 ViewControllerA 有时 ViewControllerA 的 View 会稍微向下推窗口。

这可以通过以下方式阻止:

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

ViewControllerZ 上从 ViewControllerZ 上的事件返回到 ViewControllerA

关于iphone - 包含导航栏和标签栏的 View 向下移动了大约 4mm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11389244/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com