Lewis
Lewis

Reputation: 159

Open keynote with URL reference scheme on touch of uibutton

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?

Upvotes: 0

Views: 574

Answers (1)

Venkat S. Rao
Venkat S. Rao

Reputation: 1110

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

Upvotes: 1

Related Questions