Save method in cocoatouch?
What is the save method for cocoatouch?
I need to add it where the comment is: // whatever you want to do.
- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNaviga开发者_如何学PythontionType)ntype {
if ([request.URL.scheme isEqualToString:@"hide"]) {
// whatever you want to do.
}
return true;
}
If you mean saving settings, you would usually use the NSUserDefaults.
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"ShouldDoSomething"];
And to get it back
BOOL shouldDoSomething = [[NSUserDefaults standardUserDefaults] boolForKey:@"ShouldDoSomething"];
Obviously you can set other things aside from bools, see the documention on NSUserDefaults for more.
精彩评论