UISplitview 未在顶部对齐
我有一个无法弄清楚的问题,我制作了一个在选项卡栏中使用 UIsplitview 的应用程序。我一直在实现不同的选项卡,但是现在当我在第一个选项卡上工作时 - UIsplitview 在横向模式下未对齐。你们有什么建议吗?如果我以纵向模式开始,然后转到横向模式,那就完全没有问题了。
更新: 我不会在任何地方对框架进行任何初始化,并且我已经在 IB 中检查了尺寸等。下面显示了我如何在应用程序委托中添加 uisplitview 控制器。这样做是因为我想在标签栏控制器中使用分割视图。当我添加 spilview 时,我只是在 IB 中设置了主视图和详细视图。有点神秘。
if (index == 2) {
detailViewController = [[DetailUserCreatorViewController alloc] initWithNibName:@"DetailUserCreatorView" bundle:nil];
userContent=[[UserContentForPopViewController alloc]init];
userContent.userDetails=detailViewController;
detailViewController.delegate=userContent;
//rootViewController.navigationItem.title = @"List";
UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:userContent] autorelease];
splitViewController = [[UISplitViewController alloc] init];
splitViewController.tabBarItem = controller.tabBarItem;
splitViewController.viewControllers = [NSArray arrayWithObjects:nav, detailViewController, nil];
splitViewController.delegate = detailViewController;
[controllers replaceObjectAtIndex:index withObject:splitViewController];
}
更新:我尝试在应用程序委托中的应用程序 didfinishlaunch 中设置选定的选项卡 - self.tabBarController.selectedIndex = 0;这使得选项卡在正确的位置开始。然而,这似乎不是一个正确的解决方案。
I have a problem I can't figure out, I have made an application which uses UIsplitview inside a tab bar. I have been implementing the different tabs however now when I am working on the first tab - the UIsplitview is not aligned in landscape mode. Do you guys have any suggestions - if I start it in portrait and go to landscape, then there's no problem at all.
Update:
I dont do any init with frames anywhere, and I have checked the sizes etc. in IB. The following shows how I add the uisplitview controller in the app delegate. It has been done this way because I wanted a splitview in a tabbar controller. When i have added the spilview I just set the master and detail view in IB. A bit of mystery.
if (index == 2) {
detailViewController = [[DetailUserCreatorViewController alloc] initWithNibName:@"DetailUserCreatorView" bundle:nil];
userContent=[[UserContentForPopViewController alloc]init];
userContent.userDetails=detailViewController;
detailViewController.delegate=userContent;
//rootViewController.navigationItem.title = @"List";
UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:userContent] autorelease];
splitViewController = [[UISplitViewController alloc] init];
splitViewController.tabBarItem = controller.tabBarItem;
splitViewController.viewControllers = [NSArray arrayWithObjects:nav, detailViewController, nil];
splitViewController.delegate = detailViewController;
[controllers replaceObjectAtIndex:index withObject:splitViewController];
}
Update: I tried to set the selected tab in application didfinishlaunch in the app delegate - self.tabBarController.selectedIndex = 0; and this made the tab start at the correct placement. However it does not seem to be a proper solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些指针... splitViewController 需要添加为窗口的子视图:
以下代码不正确。您不应该将 viewController 分配给委托。
您也不需要这行代码:
以下行处理分配委托的部分。
另外,如果您可以上传代码,我会尝试更正它并发回原因和更正的代码...
Some pointers...splitViewController needs to be added as a subview of window:
The following code is incorrect. You should not assign a viewController to a delegate.
You will also not require this line of code:
The following line handles that part of assigning delegates.
Also, if you can upload your code, I'll try to correct it and post back the reason and corrected code...