Question

Is this possible? I have tried this code below but I cannot get it to compile:

- (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;
}

It crashes on self.controller as it is not a property.

Any ideas?

Was it helpful?

Solution

I think you need to take out "self.". Since controller is a local variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top