macOS/iOS API解説

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

目次

valueWithRange:

指定したNSRange構造を含むNSValueを作って、返します
+(NSValue *)valueWithRange:(NSRange)range:

解説

指定したNSRange構造を含むNSValueを作って、返します。

返り値

( NSValue * )

バリュー

引数

( NSRange )range

範囲

クラス

NSValue

Class Methods

使用可能

10.0

参照

- rangeValue

例文

#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