Make a call in Objective C help!
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开发者_JAVA百科();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
NSLog(@"TEST");
}
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).
精彩评论