开发者

UISplitView: detail view is not visible

In application:didFinishLaunchingWithOptions: I'm adding a split view:

[self.window addSubview:splitViewController.view];
[self.window makeKeyAndVisible];

splitViewController comes from N开发者_运维问答IB loaded in app delegate, and is pretty simple one, with table view on the left, and some custom view on the right.

In shouldAutorotateToInterfaceOrientation: of splitViewController I'm returning NO if interfaceOrientation is either UIInterfaceOrientationPortrait or UIInterfaceOrientationPortraitUpsideDown(it makes more sense in my up to show up like this only during the 1st run).

When I run my app in the simulator (SDK 4.2), simulator is rotating to the landscape orientation as I expect, but detail view is not visible (is black). Table view on the left is just fine.

What's interesting, when I rotate simulator 2 times left or right, the detail view turns visible as expected.

It seems that at the beginning the detail view is behind some other view, I checked it by logging each view controllers' frame (in shouldAutorotateToInterfaceOrientation:):

Details VC frame: {{0, 20}, {768, 1004}}
SiteSelection frame: {{0, 20}, {768, 1004}}
SPLIT VC frame: {{0, 20}, {768, 1004}}

Also, split view controller subviews gives:

v: <UIView: 0x5c32d60; frame = (0 20; 768 1004); layer = <CALayer: 0x5c335e0>>
v: <UILayoutContainerView: 0x5c94dc0; frame = (0 0; 768 1004); clipsToBounds = YES; layer = <CALayer: 0x5c94e10>>

So it seems that for some reason table view is taking whole iPad's window frame, and is overlapping with detail custom view.

Is that correct? What could be the reason behind that? In NIB everything seems fine. I suspect that shouldAutorotateToInterfaceOrientation: is to blame. How can I fix that?


Guess what... Running exactly the same code under Xcode4 works just fine. So it's unclear to me what is wrong under Xcode3.x, or more likely, iOS Simulator.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜