NSString *str1 = [NSString stringWithFormat:@"iPhone Programming is easy]; |
3. Build & Run:
<same result>
4. Declare the NSString object "str1" also likes this:
5. Build & Run again:
Before click, the original text of label1 is "Hello Nattoise".
NSString *str1 = @"iPhone Programming is super easy"; |
Before click, the original text of label1 is "Hello Nattoise".
After click, the text of label1 is changed to "iPhone Programming is super easy".
Common class method [ + ] and instance methods [ - ]:
+ | stringWithFormat <-- Class Method [ + ] |
- | stringByAppendingString <-- Instance Method [ - ] |
- | isEqualToString |
- | length |
- | intValue |
- | floatValue |
- | uppercaseString |
- | |
- | |
- | |
- | |
- | |
- | |
- |
-: Instance Method: 需先實體化才可以使用的方法,假設str1 已經是NSString 文字實體 (生完仔, 對仔落指令)
[+] stringWithFormat: (NSString *) format
[-] (NSString *) stringByAppendingString: (NSString *) format
[-] (BOOL) isEqualToString: (NSString *) aString
[-] (NSUInteger) length
[-] (NSUInteger) intValue
[-] (float) floatValue
Reference: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html
No comments:
Post a Comment