views:

59

answers:

1

I need to make a call where it says add call here. Can someone help?

- (BOOL) webView:(UIWebView *)webView 
       shouldStartLoadWithRequest:(NSURLRequest *)request 
       navigationType:(UIWebViewNavigationType)ntype {

       NSLog(@"Scheme: %@", request.URL.scheme);
       if ([request.URL.scheme isEqualToString:@"save"]) {

        //Add Call here
    }

    return true;
}

From this code:

- (void) save {
    UIGraphicsBeginImageContext(self.view.frame.size); 
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

    NSLog(@"TEST");
}
A: 

If I'm reading the question correctly, you're probably looking to do something like:

[self save];

Assuming that the save message is declared in the same class. If the save message is in a different class, and you have an instance of that class, it'd look like:

[foo save];

Where foo is the name of the variable whose class contains the save method.

Either way, this is the standard means of "calling a method" (or, sending a message, in the Objective-C world).

John Rudy
Yes, - (void)save; is declared in my header file. But [instanceVariableName save]; doesnt work.
Henry D'Andrea
If it's in the same class, go with `[self save];`
John Rudy
Thank you, that works! Thanks for your help!
Henry D'Andrea