2010-07-30 26 views
0

HI, 我在我的iPad應用以下設置:UISplitViewController detailViewController子視圖不是方向變化適當調整

UISplitViewController DetailSide-> SomeDetailViewController-> 新增子視圖爲[SomeDetailViewController.view addSubview:AnotherViewController。查看]

  1. 現在啓動時顯示「AnotherViewController視圖」時,它的初始尺寸始終與最後一個方向相同(potrait/lands在界面構建器中的角度視圖)我保存了該視圖XIB,與當前的設備方向無關。

  2. 另外關於重新設置添加的子視圖(AnotherViewController.view)的框架,即A. In - [SomeDetailViewController viewDidLoad]檢查當前設備方向B.設置AnotherViewController.view的框架以匹配所需的大小。它沒有適當調整其後(在XIB自動調整框中正確設置了彈簧/支柱)對方向更改。

  3. 在完成上述步驟2之後,我確實發現從底部開始AnotherViewController.view的大約一半不會響應任何觸摸,看起來像是由於框架中的變化而導致響應座標變得混亂。

  4. 我確實有「shouldAutorotateToInterfaceOrientation」實現爲所有視圖控制器中的所有方向返回YES。

TIA。

回答

0

在XIB中將會有一個選項來更改Inspector中的SPlitview Detail/Master。此外,如果您將其添加爲子視圖,則無法獲取splitview委託方法,因此您需要將其添加到窗口中。嘗試從窗口中刪除所有元素使用

[[[[[UIAppDelegate window]子視圖] 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]; 

好運....

0

應設置自動調整大小屬性來AnotherViewController.view

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

相關問題