这可能吗?我已经尝试过以下代码,但我无法编译:
- (IBAction)KeynoteButton:(id)sender {
UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:@"2bm iPad presentation.key"]];
self.controller.delegate = self;
CGRect navRect = self.view.frame;
[self.controller presentOptionsMenuFromRect:navRect inView:self.view animated:YES];
}
#pragma mark - UIDocumentInteractionControllerDelegate
//===================================================================
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
return self.view.frame;
}
它在self.controller上崩溃,因为它不是属性。
有什么想法吗?
答案 0 :(得分:1)
我认为你需要拿出“自我”。由于控制器是局部变量。