NSNumber Class Reference

最終更新:

匿名ユーザー

- view
だれでも歓迎! 編集

トップ> リファレンス > データ管理:日付、時刻、数字 > NSNumber クラスリファレンス

NSNumber クラスリファレンス 翻訳元


このページの最終更新:2010-02-06
ADCの最終更新:2008-02-08


継承するクラス NSValue : NSObject
準拠しているプロトコル NSCoding (NSValue)
NSCopying (NSValue)
NSObject (NSObject)
フレームワーク /System/Library/Frameworks/Foundation.framework
使用可能な環境 Mac OS X v10.0以降
宣言ファイル NSDecimalNumber.h
NSValue.h
コンパニオンガイド Number and Value Programming Topics for Cocoa
Property List Programming Guide
サンプルコード From A View to A Movie
From A View to A Picture
QTCoreVideo301
Quartz Composer WWDC 2005 TextEdit
SimpleScriptingPlugin

概観(Overview)


 NSNumberクラスはNSValueクラスのサブクラスで、Cの全てのスカラー(数値)型の値を表します。このクラスのメソッド群は値を符号あり/なしのchar、short int、int、long int、long long int、float、double、そしてBOOL型として設定、アクセスするのに特化して定義されています。(数字オブジェクトは生成時の型を保持する必要がないことに注意してください。)また、二つのNSNumberオブジェクトの大小関係を決定する為のcompare:メソッドも定義されています。

NSNumberクラスのサブクラスの作成(Creating a Subclass of NSNumber)

 どんなクラスクラスタにも言えることですが、NSNumberクラスのサブクラスを作成する場合には、そのスーパークラスであるNSValueクラスのプリミティブメソッドをオーバーライドする必要があります。さらに、NSValueクラスのobjCTypeメソッドが返すことができる戻り値には制限があります。有効な戻り値は"c"、"C"、"s"、"S"、"i"、"I"、"l"、"L"、"q"、"Q"、"f"、"d"です。

このクラスでできること(Tasks)


NSNumberオブジェクトの生成(Creating an NSNumber Object)

    + numberWithBool:
    + numberWithChar:
    + numberWithDouble:
    + numberWithFloat:
    + numberWithInt:
    + numberWithInteger:
    + numberWithLong:
    + numberWithLongLong:
    + numberWithShort:
    + numberWithUnsignedChar:
    + numberWithUnsignedInt:
    + numberWithUnsignedInteger:
    + numberWithUnsignedLong:
    + numberWithUnsignedLongLong:
    + numberWithUnsignedShort:

NSNumberオブジェクトの初期化(Initializing an NSNumber Object)

    – initWithBool:
    – initWithChar:
    – initWithDouble:
    – initWithFloat:
    – initWithInt:
    – initWithInteger:
    – initWithLong:
    – initWithLongLong:
    – initWithShort:
    – initWithUnsignedChar:
    – initWithUnsignedInt:
    – initWithUnsignedInteger:
    – initWithUnsignedLong:
    – initWithUnsignedLongLong:
    – initWithUnsignedShort:

数値へのアクセス(Accessing Numeric Values)

    – boolValue
    – charValue
    – decimalValue
    – doubleValue
    – floatValue
    – intValue
    – integerValue
    – longLongValue
    – longValue
    – shortValue
    – unsignedCharValue
    – unsignedIntegerValue
    – unsignedIntValue
    – unsignedLongLongValue
    – unsignedLongValue
    – unsignedShortValue

文字列表現に直す(Retrieving String Representations)

    – descriptionWithLocale:
    – stringValue

NSNumberオブジェクトの比較(Comparing NSNumber Objects)

    – compare:
    – isEqualToNumber:

型情報へのアクセス(Accessing Type Information)

    – objCType

クラスメソッド



インスタンスメソッド





+ タグ編集
  • タグ:
  • Cocoa
  • リファレンス
  • Dates Times & Numbers
  • 未完

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

目安箱バナー