我曾使用以下代码从SplitViewcontroller的Rootviewcontroller中显示一个viewcontroller。在iOS 5.1竖屏模式下不会显示任何内容。当横向时,它会在Rootviewcontroller内显示控制器。在iOS 5.0之前都可以正常工作。
-(void)displayFileInReader:(NSURL *)fileURL {
SPDocumentReader *objiPadDocumentReader = [[SPDocumentReader alloc] init];
objiPadDocumentReader.readerType = ReaderTypeLocalCachedDocument;
objiPadDocumentReader.url = fileURL;
UINavigationController *objNavigationController = [[UINavigationController alloc] initWithRootViewController:objiPadDocumentReader];
objNavigationController.navigationBar.barStyle = UIBarStyleBlack;
[self presentModalViewController:objNavigationController animated:YES];
[objNavigationController release];
objNavigationController = nil;
[objiPadDocumentReader release];
objiPadDocumentReader = nil;
}
我使用 self.splitviewcontroller 并使用 detailviewcontroller实例 代替 self。
但在这种情况下,当我们点击 detailview controller 来解除/删除 rootviewcontroller 时,会导致崩溃,显示类似于“视图没有窗口”的错误信息。
此外,在 iOS 5.1 中,根视图有时会显示错误的方向。
提前感谢。