Instance Method インスタンスメソッド

initWithString:relativeToURL:

Initializes an NSURL object with a base URL and a relative string. NSURLオブジェクトをある基準URLと相対文字列で初期化します。

Declaration 宣言

- (instancetype)initWithString:(NSString *)URLString 
                 relativeToURL:(NSURL *)baseURL;

Parameters パラメータ

URLString

The URL string with which to initialize the NSURL object. Must conform to RFC 2396. URLString is interpreted relative to baseURL. URL文字列、それでNSURLオブジェクトを初期化することになります。RFC 2396に準拠しなければなりません。URLStringは、baseURLに相対的であると解釈されます。

baseURL

The base URL for the NSURL object. NSURLオブジェクトに対する基準URL。

Return Value 戻り値

An NSURL object initialized with URLString and baseURL. If URLString was malformed, returns nil. あるNSURLオブジェクト、初期化をURLStringbaseURLでされます。URLStringが不正な形式だったならば、nilを返します。

Discussion 議論

This method allows you to create a URL relative to a base path or URL. For example, if you have the URL for a folder on disk and the name of a file within that folder, you can construct a URL for the file by providing the folder’s URL as the base path (with a trailing slash) and the filename as the string part. このメソッドは、あなたにあるURLをある基準のパスまたはURLと相対的に作成させます。例えば、あなたがディスク上のあるフォルダに対するURLそしてそのフォルダ内のあるファイルの名前を持つならば、あなたはあるURLをそのファイルに対して組み立てることがフォルダの持つURLを基準パスとしてそしてファイル名を文字列部分として提供することによって可能です。

This method expects URLString to contain only characters that are allowed in a properly formed URL. All other characters must be properly percent escaped. Any percent-escaped characters are interpreted using UTF-8 encoding. このメソッドは、適切に形成されたURLに入れるのを許可される文字のみを含むことをURLStringに期待します。全ての他の文字は、適切にパーセントエスケープされなければなりません。あらゆるパーセントエスケープされた文字は、UTF-8符号化を使って解釈されます。

initWithString:relativeToURL: is the designated initializer for NSURL. initWithString:relativeToURL:は、NSURLに対する指定イニシャライザです。

See Also 参照

Creating an NSURL Object NSURLオブジェクトを作成する

Related Documentation 関連文書