-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotes.m
More file actions
45 lines (31 loc) · 1.17 KB
/
Notes.m
File metadata and controls
45 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#import "Notes.h"
@implementation Notes
@dynamic title;
@dynamic content;
@dynamic viewPosition;
@dynamic insertionPoint;
@dynamic createDate;
@dynamic modifyDate;
- (NSString *)title {
[[self managedObjectContext] processPendingChanges];
[[[self managedObjectContext] undoManager] disableUndoRegistration];
[self willAccessValueForKey:@"content"];
NSString *value = [self primitiveValueForKey:@"content"];
[self didAccessValueForKey:@"content"];
[[self managedObjectContext] processPendingChanges];
[[[self managedObjectContext] undoManager] enableUndoRegistration];
return [self titleFromString:value];
}
- (void)setContent:(NSString *)theContent {
[[self managedObjectContext] processPendingChanges];
[[[self managedObjectContext] undoManager] disableUndoRegistration];
[self willChangeValueForKey:@"content"];
[self setPrimitiveValue:theContent forKey:@"content"];
[self didChangeValueForKey:@"content"];
[[self managedObjectContext] processPendingChanges];
[[[self managedObjectContext] undoManager] enableUndoRegistration];
}
- (NSString *)titleFromString:(NSString *)theString {
return [[theString componentsSeparatedByString:@"\n"] objectAtIndex:0];
}
@end