I have a doubt about initializing string with synthesize keyword.
In my Event.h class I have
@interface Event : NSObject {
NSString *title;
}
@property (nonatomic, retain) NSString *title;
and in Event.h I have
@synthesize title;
However when I want to set the title from my main class and I display the content in the console, I get null:
[self.currentEvent.title stringByAppendingString:@"hello"];
NSLog(@"%@", self.currentEvent.title); //this is null
Is because I don’t properly initialize the title variable in Event? Isn’t synthesize initializing it for me?
@synthesize creates the setter and getter methods for you, but does not initialize
Fastest way to get up to speed with this stuff is to watch “Developing Apps for iOS” by Paul Hegarty / Stanford University, available free on iTunes.