NsrangeUsed to denote the scope of a related thing, by ipkhj the range of characters in a string or the range of elements in an array. The location field holds the starting position of the range, and the length field is the number of elements contained within the range. Nsrange range = {17,4}nsrange range = Nsmakerange (17,4);NspointRepresents a point in the Cartesian plane (x, y); The Nsmakepoint (); nssize is used to store length and width width,height; Nsmakesize (); nsrect rectangle data origin,size; Nsmakerect (); nsstring cannot be modified after instantiation such as deleting a character or adding a character to change the way it stringWithFormat class method, do not need to instantiate the class to call directly, Supports multiple dynamic parameter length size lengths, capable of handling international strings correctly such as, Russian, Chinese isequaltostring is used to compare the receiver (the object receiving the message) and the string passed as a parameter, returning a Bool compare Compares the received object to the passed string character, which returns a Nscomparisonresult (an enum data) Nsorderedascending=-1 The left value is less than the value on the right. Nsorderedsame on both sides of the same string, nsordereddescending, the right value is less than the left value compare two strings are equal, should use isequaltostring,- (Nscomparisonresult) Compare: (NSString *) string options: (unsigned) mask;options values are: Nscaseinsensitivesearch: Uppercase and lowercase characters nsliteralsearch: Do a full comparison, case-sensitive nsnumericsearch: Compares the number of characters in a string, not the string-(BOOL) Hasprefix: (NSString *) astring; Determines whether to start- (BOOL) Hassuffix with the specified string: (NSString *) astring; Determines whether to end with the specified string-(Nsrange) rangeofstring: (NSString *) astring ; Whether somewhere inside the string contains other strings nsmutablestring+ (ID) stringwithcapacity: (unsigned) capacity; Used to create object-(ID) appendString: (NSString) astring; Append new string-(ID) AppendFormat: (nsstring) format,.....; Append formatted string-(void) Deletecharactersinrange: (nsrange) range; Delete characters in string NSArray An array of immutable objects, like NSString, can store only object-c objects, not basic data types in C, such as int, float, enum, struct, or random pointers in Nsarray. Also, you cannot store nil (0 or null values of objects) in Nsarray, and you can create a new nsarray by using the class method arraywithobjects. Nsarray *array;array = [Nsarray arraywithobjects:@ "one", @ "one", @ "three", nil]-(unsigned) count; Get the number of objects it contains-(ID) Objectatindex: (unsigned int) index gets the object of a particular index nsstring *string = @ "Oop:ack:bork:greeble:ponies"; Nsarray *chunks = [string componentsseparatedbystring: @ ":"] use nsstring-componentsseparatedbystring to slice nsarraystring = [Chunks componentsjoinedbystring:@ ":"] Merge Nsarray nsmutablearray with componentsjoinedbystring variable array nsmutablearray create new mutable array + (ID) Arraywithcapacity by class method arraywithcapacity: (unsigned) numitems;-(void) AddObject: (ID) anobject; Add an object at the end of the array-(void) Removeobjectatindex: (unsigned) index deletes the object at a specific index nsenumerator It is a way for cocoa to describe this set of lost-generation operations. To use Nsenumerator, you canTo request an enumerator by Objectenumerator to an array:-(nsenumerator*) objectenumerator;eg:nsenumerator *enumerator;enumerator = [array Objectenumerator]; If you want to browse the collection from behind, there is a method reverseobjectenumerator-(ID) nextobject; Gets the next object, and when Nextobject returns a nil value, the loop ends. Eg:id thingie;while (thingie = [Enumerator nextobject]) {...} There is also one way to loop an array: for (nsstring *string in array) {NSLog (@ "I found%@", string);} nsdictionary a value (which can be any type of object) under a given keyword (usually a nsstring string). Then you can use this keyword to find the corresponding value. When you create a new nsdictionary, you provide all the objects and keywords that the dictionary stores. + (ID) Dictionarywithobjectsandkeys: (ID) firstobject,...; Create a dictionary. This method accepts the system of alternating storage of objects and keywords, with the nil value as the terminating symbol (the nil value cannot be stored in nsdictionary) eg:nsdictionary *tires;tires = [nsdictionary dictionarywithobjectsandkeys:t1,@ "Front-left", t2,@ "Front-right", t3,@ "Back-left", t4,@ "Back-right", nil];// T is an object instance-(ID) Objectforkey: (ID) Akey; Getting a value in a dictionary, such as a key that does not exist, returns a nil value NSMutableDictionary allows you to add and remove a dictionary element with a negative meaning. To create a new Nsmutabledictionary object, send a dictionary message to the class nsmutabledictionary. You can also use the Dictionarywithcapacity: method to create a new mutable dictionary and tell cocoa the final size of the Dictionary + (ID) dictionarywithcapAcity: (unsigned int) numitems; create dictionary dictionary eg:nsmutabledictionary *tires;tires = [Nsmutabledictionary dictionary] ;-(void) SetObject: (ID) anobject Forkey: (ID) akey; add value to Dictionary-(void) Removeobjectforkey: (ID) Akey; Removes the value from the collection nsnumber the wrapper base data type. You can use the following class methods to create a new NSNumber object: + (NSNumber *) Numberwithchar: (char) value;+ (NSNumber *) Numberwithint: (int) value;+ (nsnumber *) Numberwithfloat: (float) value;+ (NSNumber *) Numberwithbool: (BOOL) value; When a basic type of data is encapsulated in NSNumber, It can be re-obtained by the following instance method:-(char) charvalue;-(int) intvalue;-(float) floatvalue;-(BOOL) boolvalue;-(NSString *) stringvalue; With Numberwithfloat: Created NSNumber can use Intvalue to extract values. The NSNumber will convert the data appropriately. nsvalue+ (Nsvalue *) Valuewithbytes: (const void *) value objctype: (const char *) type; Create a new nsvalue-(void) GetValue: (void *) value; An object notation for extracting numeric nsnullnil, using nsnull+ (NSNull *) null where nil is not possible; Create a new Nsnull
Object-c Foundation Kit framework in iOS