NSMapTable
NSMapTable 类似 NSDictionary,但可以配置 key/value 的指针语义(例如 weak-to-strong 等)。在插件里你多半用于读写映射关系,而不是追求底层内存语义细节。
类成员 (Class members)
Section titled “类成员 (Class members)”mapTableWithKeyOptionsValueOptions
Section titled “mapTableWithKeyOptionsValueOptions”按 key/value 选项创建。
static mapTableWithKeyOptionsValueOptions(keyOptions: number, valueOptions: number): NSMapTableParameters:
| Name | Type | Description |
|---|---|---|
keyOptions | number | key 选项。 |
valueOptions | number | value 选项。 |
Return Value:
NSMapTable: 新实例。
strongToStrongObjectsMapTable
Section titled “strongToStrongObjectsMapTable”强 key、强 value 的对象映射表。
static strongToStrongObjectsMapTable(): NSMapTableReturn Value:
NSMapTable: 新实例。
weakToStrongObjectsMapTable
Section titled “weakToStrongObjectsMapTable”弱 key、强 value 的对象映射表。
static weakToStrongObjectsMapTable(): NSMapTableReturn Value:
NSMapTable: 新实例。
strongToWeakObjectsMapTable
Section titled “strongToWeakObjectsMapTable”强 key、弱 value 的对象映射表。
static strongToWeakObjectsMapTable(): NSMapTableReturn Value:
NSMapTable: 新实例。
weakToWeakObjectsMapTable
Section titled “weakToWeakObjectsMapTable”弱 key、弱 value 的对象映射表。
static weakToWeakObjectsMapTable(): NSMapTableReturn Value:
NSMapTable: 新实例。
实例成员 (Instance members)
Section titled “实例成员 (Instance members)”键值对个数。
count(): numberReturn Value:
number: 个数。
objectForKey
Section titled “objectForKey”按键取值。
objectForKey(aKey: any): anyParameters:
| Name | Type | Description |
|---|---|---|
aKey | any | 键。 |
Return Value:
any: 值或 undefined。
dictionaryRepresentation
Section titled “dictionaryRepresentation”转为 NSDictionary 表示。
dictionaryRepresentation(): NSDictionaryReturn Value:
NSDictionary: 字典表示。
keyEnumerator
Section titled “keyEnumerator”键枚举器。
keyEnumerator(): NSEnumeratorReturn Value:
NSEnumerator: 键枚举器。
objectEnumerator
Section titled “objectEnumerator”值枚举器。
objectEnumerator(): NSEnumeratorReturn Value:
NSEnumerator: 值枚举器。
keyPointerFunctions
Section titled “keyPointerFunctions”key 指针函数配置。
keyPointerFunctions(): anyReturn Value:
any: 指针函数对象。
valuePointerFunctions
Section titled “valuePointerFunctions”value 指针函数配置。
valuePointerFunctions(): anyReturn Value:
any: 指针函数对象。
setObjectForKey
Section titled “setObjectForKey”设置键值对。
setObjectForKey(anObject: any, aKey: any): voidParameters:
| Name | Type | Description |
|---|---|---|
anObject | any | 值。 |
aKey | any | 键。 |
Return Value:
- 无。
removeObjectForKey
Section titled “removeObjectForKey”移除键对应条目。
removeObjectForKey(aKey: any): voidParameters:
| Name | Type | Description |
|---|---|---|
aKey | any | 键。 |
Return Value:
- 无。
removeAllObjects
Section titled “removeAllObjects”清空映射表。
removeAllObjects(): voidReturn Value:
- 无。