I have a string (titleName) stored in a class (newNoteBook) stored in an array (myLibrary). I was trying to access it, but I only get a (null) printed in the log.
What am I doing wrong?
-(void) setupLibrary {
NoteBook *newNoteBook = [[NoteBook alloc] init];
newNoteBook.titleName = @"TEST";
NSLog(@"titleName:%@", newNoteBook.titleName); // this prints TEST in the log
[myLibrary addObject:newNoteBook];
NSLog(@"titleName:%@", [[self.myLibrary objectAtIndex:0] titleName]); // this prints (null) in the log)
}
There is nothing fancy in my class... simply:
@interface NoteBook : NSObject {
NSString *titleName; }
@property (nonatomic, retain) NSString *titleName;
@end
@implementation NoteBook
@synthesize titleName;