1
edit
Changes
→Apple Development
<h5>String Conversion between NSString and C strings</h5>
<span style="color:#6600FF;">NSString </span> *nsstr; <span style="color:#6600FF;">const char </span> *cstr = <span style="color:#CC0000;">"Open Source!"</span>;
<span style="color:#336633;">// Convert a C string to a NSString</span> nsstr = [<span style="color:#6600FF;">NSString </span> <span style="color:#660099;">stringWithUTF8String</span>:cstr];
<span style="color:#336633;">// Convert a NSString to a C string</span> cstr = [nsstr <span style="color:#660099;">UTF8String</span>];
<br />
<h6>[http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html NSObject]</h6>
<ul>
<li><i>'''''- (id)init</i>'''''</li>
<span style="color:#6600FF;">NSObject </span> *newNSObject = [[<span style="color:#6600FF;">NSObject </span> <span style="color:#660099;">alloc</span>] <span style="color:#660099;">init</span>];
<li><i>'''''- (NSString *)description</i>'''''</li>
<span style="color:#660099;">NSLog</span>(<span style="color:#CC0000;">@"Open Source Account Number: %d is %@"</span>, i, accountToPrint);
is equivalent to
<span style="color:#660099;">NSLog</span>(<span style="color:#CC0000;">@"Open Source Account Number: %d is %@"</span>, i, [accountToPrint <span style="color:#660099;">description</span>]);
<li><i>'''''- (BOOL)isEqual:(id)that</i>'''''</li>
<span style="color:#336633;">// compares the logic written in the isEqual methods</span> if ([this <span style="color:#660099;">isEqual</span>:that]) { ... }
may not be equivalent to
<span style="color:#336633;">// compares the values of the two pointers</span>
this == that;