Sha*_*ank 11 objective-c ipad ios
我在mainViewControllers视图中添加了UISplitViewController视图,代码如下.
documentsRootViewController = [[DocumentsRootViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:documentsRootViewController];
documentsRootViewController.title = @"Document List";
documentDetailView = [[DocumentsDetailView alloc] initWithNibName:@"DocumentsDetailView" bundle:nil];
documentsRootViewController.detailViewController = documentDetailView;
docSplitViewController = [[UISplitViewController alloc] init];
docSplitViewController.viewControllers = [NSArray arrayWithObjects:navigationController, documentDetailView, nil];
docSplitViewController.delegate = documentDetailView;
CGRect splitViewFrame = CGRectMake(0, 0, cetralArea.frame.size.width, cetralArea.frame.size.height);
docSplitViewController.view.frame = splitViewFrame;
[cetralArea addSubview:docSplitViewController.view];
Run Code Online (Sandbox Code Playgroud)
现在我想要的是从UISplitViewController的DetailView呈现一个ViewController我试图在DetailViewControllers下面单击我这样做!按钮单击.

- (IBAction) buttonClicked:(id)sender
{
NSString *phrase = nil; // Document password (for unlocking most encrypted PDF files)
NSArray *pdfs = [[NSBundle mainBundle] pathsForResourcesOfType:@"pdf" inDirectory:nil];
NSString *filePath = [pdfs lastObject]; assert(filePath != nil); // Path to last PDF file
ReaderDocument *readerDocument = [ReaderDocument withDocumentFilePath:filePath password:phrase];
if (readerDocument != nil) // Must have a valid ReaderDocument object in order to proceed with things
{
ReaderViewController *rViewController = [[ReaderViewController alloc] initWithReaderDocument:readerDocument];
rViewController.delegate = self; // Set the ReaderViewController delegate to self
[self presentModalViewController:rViewController animated:NO];
}
}
Run Code Online (Sandbox Code Playgroud)
但这导致了一个尴尬的演示

任何人都可以在这里提出什么问题,提前谢谢..
在您的屏幕截图中,我无法真正判断您的分割视图控制器左侧和右侧(详细视图)位于何处。更改视图的背景颜色以区分位置。看来你和他们之间有问题。
无论如何,您可以尝试从 splitView 而不是 Detail 中呈现模态视图控制器。
[splitViewController presentModalViewController:rViewController animated:NO];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2207 次 |
| 最近记录: |