NSPointerArray
NSPointerArray 是“指针数组”容器,允许存放对象指针或空洞,并支持强/弱语义(例如 weakObjectsPointerArray())。在插件里通常把它当成“特殊数组”来用。
类成员 (Class members)
Section titled “类成员 (Class members)”strongObjectsPointerArray
Section titled “strongObjectsPointerArray”创建强引用指针数组。
static strongObjectsPointerArray(): NSPointerArrayReturn Value:
NSPointerArray: 新实例。
weakObjectsPointerArray
Section titled “weakObjectsPointerArray”创建弱引用指针数组。
static weakObjectsPointerArray(): NSPointerArrayReturn Value:
NSPointerArray: 新实例。
实例成员 (Instance members)
Section titled “实例成员 (Instance members)”元素个数。
count(): numberReturn Value:
number: 个数。
setCount
Section titled “setCount”设置元素个数。
setCount(count: number): voidParameters:
| Name | Type | Description |
|---|---|---|
count | number | 新个数。 |
Return Value:
- 无。
pointerAtIndex
Section titled “pointerAtIndex”取指定索引的指针。
pointerAtIndex(index: number): anyParameters:
| Name | Type | Description |
|---|---|---|
index | number | 索引。 |
Return Value:
any: 指针或 null。
addPointer
Section titled “addPointer”在末尾添加指针。
addPointer(pointer: any): voidParameters:
| Name | Type | Description |
|---|---|---|
pointer | any | 要添加的指针。 |
Return Value:
- 无。
removePointerAtIndex
Section titled “removePointerAtIndex”移除指定索引的指针。
removePointerAtIndex(index: number): voidParameters:
| Name | Type | Description |
|---|---|---|
index | number | 索引。 |
Return Value:
- 无。
insertPointerAtIndex
Section titled “insertPointerAtIndex”在指定索引插入指针。
insertPointerAtIndex(item: any, index: number): voidParameters:
| Name | Type | Description |
|---|---|---|
item | any | 指针。 |
index | number | 索引。 |
Return Value:
- 无。
replacePointerAtIndexWithPointer
Section titled “replacePointerAtIndexWithPointer”替换指定索引的指针。
replacePointerAtIndexWithPointer(index: number, item: any): voidParameters:
| Name | Type | Description |
|---|---|---|
index | number | 索引。 |
item | any | 新指针。 |
Return Value:
- 无。
compact
Section titled “compact”移除空洞,压缩数组。
compact(): voidReturn Value:
- 无。
allObjects
Section titled “allObjects”所有非空指针组成的数组。
allObjects(): NSArrayReturn Value:
NSArray: 对象数组。
pointerFunctions
Section titled “pointerFunctions”指针函数配置。
pointerFunctions(): anyReturn Value:
any: 指针函数对象。