Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of Objective-C Common class in ios

Shulou Source: shulou.com Published: 2022-06-02 11:53:43 10月02日 Update

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.

Tags: Articles commonly used examples analysis methods more loops good practical content characters instances objects totals arrays articles knowledge tigers references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft NVidia vpn Apple