Example Analysis of Objective-C Common class in ios
This article will explain in detail the example analysis of Objective-C class commonly used in ios. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
NSRange (location, length):
Eg:
NSRange R1 = {2hello kitty 5}; NSRange R2 = {.location = 2, .length = 5}; NSRange R3 = NSMakeRange (2Power5); / / Development NSRange R4 = [@ "hello kitty", rangeOfString:@ "kit"]; / / R4 = {6 NSRange 3} NSRange R5 = [@ "hello kitty", rangeOfString:@ "java"]; / / R5 = {NSNotFound,0}
Ps: NSNotFound =-1
NSString: its instance can contain any Unicode character
Eg:
NSString * name = @ "Big Tiger"
Methods:
-(NSUInteger) length
-(BOOL) isEqualToString: (NSString *) other
-(NSString *) uppercaseString
-(NSRange) rangeOfString: (NSString *) aString
NSArray:
Methods:
-(NSUInteger) count
The for loop array uses it, and you can add or remove array objects in the loop; the total is automatically calculated in fast enumeration, but there can be no add and delete operations:
For (type * object in collection) {statements} this is the end of the article on "sample Analysis of Objective-C commonly used in ios". I hope the above content can be of some help to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.