0

嗨,我的 iPad 应用程序中有以下设置:

UISplitViewController DetailSide-> SomeDetailViewController-> 添加子视图为 [SomeDetailViewController.view addSubview:AnotherViewController.view]

  1. 现在,在显示“AnotherViewController 视图”时启动后,其初始尺寸始终与上一个方向相同(界面生成器中的纵向/横向视图)我保存了该视图 XIB,而与当前设备方向无关。

  2. 同样在重置添加的子视图(AnotherViewController.view)的框架时,即 A. 在 -[SomeDetailViewController viewDidLoad] 检查当前设备方向 B. 设置 AnotherViewController.view 的框架以匹配所需的大小。此后它不会在方向更改时适当调整大小(我在 XIB 自动调整大小框中正确设置了弹簧/支柱)。

  3. 完成上面的步骤 2 之后,我确实看到底部的 AnotherViewController.view 中大约有一半没有响应任何触摸,看起来由于帧的变化,响应坐标变得混乱。

  4. 我确实实现了“shouldAutorotateToInterfaceOrientation”,以便为我所有视图控制器中的所有方向返回 YES。

TIA。

4

2 回答 2

0

您应该将 autoresize 属性设置为AnotherViewController.view

AnotherViewController.view.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

于 2011-05-25T08:47:48.507 回答
0

在 XIB 中,将有一个选项可以更改 Inspector 中的 SPlitview Detail/Master。此外,如果您将其添加为子视图,您将无法获得 splitview 委托方法,因为您需要将其添加到窗口中。尝试使用从窗口中删除所有元素

[[[[UIAppDelegate 窗口] 子视图] objectAtIndex:0] removeFromSuperview]; self.appDelegate.splitViewControllerObject = [[UISplitViewController alloc] init];

UINavigationController *rootNav = [[UINavigationController alloc]initWithRootViewController:masterview]; UINavigationController *detailNav = [[UINavigationController alloc]initWithRootViewController:detailview];

    self.appDelegate.splitViewControllerObject.viewControllers = [NSArray arrayWithObjects:rootNav, detailNav, nil];
    self.appDelegate.splitViewControllerObject.delegate = detailviewobj;

    [UIAppDelegate.window addSubview:self.appDelegate.splitViewControllerObject.view];

祝你好运....

于 2011-05-12T14:09:37.267 回答