|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
NSString * aString = [@"How does this initialize the object?"];
That should be
NSString* aString = @"How does this initialize the object?";
and is just a short cut. The compiler just takes care of creating the
NSString object. One reason for this is simply as a time save; strings
are used all over the place, and the shortcut makes it easier is all.
The following are functionally equivalent:
NSString* aString = @"aString";
NSString* aString = [NSString stringWithString: @"aString"];
NSString* aString = [[NSString alloc] initWithString: @"aString"];
It's just a mater of convenience; which would you rather type?
|>Object alloc questions (From: J Tichenor <email@hidden>)|
|>Re: Object alloc questions (From: T Reaves <email@hidden>)|
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.