ios USURL用法注意事项

来源:互联网 发布:域名反向解析 编辑:程序博客网 时间:2024/05/20 15:49

    NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"];

    [NSURL URLWithString:@"foo" relativeToURL:baseURL];                  //http://example.com/v1/foo

    [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL];          //http://example.com/v1/foo?bar=baz

    [NSURL URLWithString:@"/foo" relativeToURL:baseURL];                 //http://example.com/foo

    [NSURL URLWithString:@"foo/" relativeToURL:baseURL];                 //http://example.com/v1/foo

    [NSURL URLWithString:@"/foo/" relativeToURL:baseURL];                //http://example.com/foo/

    [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; //http://example2.com/

0 0
原创粉丝点击