Ojbect-C2 4、NSDictionary和NSMutableDictionary字典的使用

来源:互联网 发布:it培训学校 编辑:程序博客网 时间:2024/05/29 04:08

Adopted Protocols

NSCoding
  • encodeWithCoder:

  • initWithCoder:

NSCopying
  • copyWithZone:

NSMutableCopying
  • mutableCopyWithZone:

NSFastEnumeration
  • countByEnumeratingWithState:objects:count:

Tasks

Creating a Dictionary

  • + dictionary
  • + dictionaryWithContentsOfFile:
  • + dictionaryWithContentsOfURL:
  • + dictionaryWithDictionary:
  • + dictionaryWithObject:forKey:
  • + dictionaryWithObjects:forKeys:
  • + dictionaryWithObjects:forKeys:count:
  • + dictionaryWithObjectsAndKeys:

Initializing an NSDictionary Instance

  • – initWithContentsOfFile:
  • – initWithContentsOfURL:
  • – initWithDictionary:
  • – initWithDictionary:copyItems:
  • – initWithObjects:forKeys:
  • – initWithObjects:forKeys:count:
  • – initWithObjectsAndKeys:
  • – init

Creating Key Sets for Shared-Key Optimized Dictionaries

  • + sharedKeySetForKeys:

Counting Entries

  • – count

Comparing Dictionaries

  • – isEqualToDictionary:

Accessing Keys and Values

  • – allKeys
  • – allKeysForObject:
  • – allValues
  • – getObjects:andKeys:
  • – objectForKey:
  • – objectForKeyedSubscript:
  • – objectsForKeys:notFoundMarker:
  • – valueForKey:

Enumerating Dictionaries

  • – keyEnumerator
  • – objectEnumerator
  • – enumerateKeysAndObjectsUsingBlock:
  • – enumerateKeysAndObjectsWithOptions:usingBlock:

Sorting Dictionaries

  • – keysSortedByValueUsingSelector:
  • – keysSortedByValueUsingComparator:
  • – keysSortedByValueWithOptions:usingComparator:

Filtering Dictionaries

  • – keysOfEntriesPassingTest:
  • – keysOfEntriesWithOptions:passingTest:

Storing Dictionaries

  • – writeToFile:atomically:
  • – writeToURL:atomically:

Accessing File Attributes

  • – fileCreationDate
  • – fileExtensionHidden
  • – fileGroupOwnerAccountID
  • – fileGroupOwnerAccountName
  • – fileHFSCreatorCode
  • – fileHFSTypeCode
  • – fileIsAppendOnly
  • – fileIsImmutable
  • – fileModificationDate
  • – fileOwnerAccountID
  • – fileOwnerAccountName
  • – filePosixPermissions
  • – fileSize
  • – fileSystemFileNumber
  • – fileSystemNumber
  • – fileType

Creating a Description

  • – description
  • – descriptionInStringsFileFormat
  • – descriptionWithLocale:
  • – descriptionWithLocale:indent:








NSMutableDictionary


Tasks

Creating and Initializing a Mutable Dictionary

  • + dictionaryWithCapacity:
  • – initWithCapacity:
  • – init
  • + dictionaryWithSharedKeySet:

Adding Entries to a Mutable Dictionary

  • – setObject:forKey:
  • – setObject:forKeyedSubscript:
  • – setValue:forKey:
  • – addEntriesFromDictionary:
  • – setDictionary:

Removing Entries From a Mutable Dictionary

  • – removeObjectForKey:
  • – removeAllObjects
  • – removeObjectsForKeys:

原创粉丝点击