간단한 노트 앱을 쓰고 있습니다. 그러나 note.title에 제목을 할당하려고하면 오류가 발생합니다.셀 제목의 텍스트를 설정할 수 없습니다.
-(Notez*)createNoteWithTitle:(NSString*)titleNote andText:(NSString*)textNote
{
Notez *newNote = [Notez new];
if (!_notesArray) {
_notesArray = [NSMutableArray new];
}
newNote.dateCreated = [NSDate new];
newNote.title = [NSString stringWithFormat:@"23"];
newNote.text = [NSString stringWithFormat:@"233"];
[_notesArray addObject:newNote];
return newNote;
}
Notez.h : # import를
@interface Notez : NSObject
@property NSString *text;
@property NSString *title;
@property NSDate* dateCreated;
-(Notez*)createNoteWithTitle:(NSString*)title andText:(NSString*)text;
-(void)save;
+(instancetype)sharedManager;
-(NSArray*)sortedNotes;
-(void)removeNoteAtIndex:(NSUInteger)index;
@end
note.dateCreated는 OK이지만, note.title 및 note.text 없습니다.
그들은 ... 모두는 NSString 있습니다
- (IBAction)addNote:(id)sender {
[[Notez sharedManager] createNoteWithTitle:@"Note Title" andText:@"Note Text"];
}
1) '메모'클래스에 대한 더 자세한 정보를 제공해야합니다. 2)'stringWithFormat'을 오용하지 마십시오. 그냥'newNote.title = @ "23";'을해라. – rmaddy
+ BarButtonItem –
을 탭하면 'Notez.h' 파일을 우리와 공유 할 수 있습니까? – nburk