开发者

Save method in cocoatouch?

开发者 https://www.devze.com 2022-12-29 10:29 出处:网络
What is the save method for cocoatouch? I need to add it where the comment is: // whatever you want to do.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号