Apple WebObjects 3.5 Bedienungsanleitung Seite 204

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 218
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 203
Chapter 11 WebScript Programmer’s Quick Reference to Foundation Classes
204
– isEqual:
Returns YES if the specified object is a dictionary and has contents
equivalent to the receiver; NO, otherwise. Two dictionaries have
equivalent contents if they each hold the same number of entries and,
for a given key, the corresponding value objects in each dictionary
satisfy the
isEqual: test.
– objectForKey:
Returns the object that corresponds to a specified key. For example,
the following code excerpt produces the NSString
sectionPreference with
the contents “non-smoking”:
id preferences = [NSMutableDictionary
dictionaryWithObjects:@("window", "non-smoking", "747")
forKeys:@("seatAssignment", "section", "aircraft")];
id sectionPreference = [dictionary objectForKey:@"section"];
Adding, Removing, and Modifying Entries
Warning: The following methods are not supported by NSDictionary. They are
available only to NSMutableDictionary objects.
– setObject:forKey:
Adds an entry to the receiver, consisting of a specified key and its
corresponding value object. If the receiver already has an entry for the
specified key, the previous value for that key is replaced with the
argument for
setObject:. For example, the following code excerpt
produces the NSMutableDictionary
dictionary with the value “non-
smoking” for the key “section” and the value “aisle” for the key
“seatAssignment.” Notice that the original value for “seatAssignment”
is replaced:
id dictionary = [NSMutableDictionary dictionaryWithDictionary:
@{"seatAssignment" = "window"}];
[dictionary setObject:@"non-smoking" forKey:@"section"];
[dictionary setObject:@"aisle" forKey:@"seatAssignment"];
It is an error to specify nil as an argument for setObject: or forKey:. You can’t
put
nil in a dictionary as a key or as a value.
– addEntriesFromDictionary:
Adds the entries from a specified dictionary to the receiver. If both
dictionaries contain the same key, the receiver’s previous value for that
key is replaced with the new value.
– removeAllObjects
Empties the dictionary of its entries.
Seitenansicht 203
1 2 ... 199 200 201 202 203 204 205 206 207 208 209 ... 217 218

Kommentare zu diesen Handbüchern

Keine Kommentare