macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

rangeValue

NSRangeを返します

解説

NSRangeを返します。

返り値

( NSRange )

範囲

引数

クラス

NSValue

Instance Methods

使用可能

10.0

参照

+ valueWithRange:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
	//Rangeを渡す場合
	NSRange aRange = NSMakeRange(1,10);
	NSValue *theValue3 = [NSValue valueWithRange:aRange];
	NSRange bufferRange;
	[theValue3 getValue:&bufferRange];
	NSLog(@"---%u,%u",bufferRange.location,bufferRange.length);
	NSLog(@"---%u,%u",[theValue3 rangeValue].location,[theValue3 rangeValue].length);

}

@end