This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code in App Delegate. | |
- (void) awakeFromNib { | |
NSNotificationCenter *nc; | |
nc = [NSNotificationCenter defaultCenter]; | |
[nc addObserver:self | |
selector:@selector(syncKVO:) | |
name:NSManagedObjectContextObjectsDidChangeNotification | |
object:nil]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)syncKVO:(NSNotification *)notification { | |
NSDictionary *userInfoDictionary = [notification userInfo]; | |
NSSet *deletedObjects = [userInfoDictionary objectForKey:NSDeletedObjectsKey]; | |
NSSet *changedObjects = [userInfoDictionary objectForKey:NSUpdatedObjectsKey]; | |
if ([deletedObjects count]) { | |
//do something if it contains objects | |
} else { | |
if ([changedObjects count]) { | |
//do something if it contains objects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)awakeFromNib { | |
NSNotificationCenter *nc; | |
nc = [NSNotificationCenter defaultCenter]; | |
[nc addObserver:self | |
selector:@selector(syncKVO:) | |
name:NSManagedObjectContextObjectsDidChangeNotification | |
object:nil]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSNotificationCenter *nc; | |
nc = [NSNotificationCenter defaultCenter]; | |
[nc removeObserver:self | |
name:NSManagedObjectContextObjectsDidChangeNotification | |
object:nil]; | |
NSManagedObjectContext *moc = [self managedObjectContext]; | |
[syncButton setTitle:@"Syncing..."]; | |
NSString *dateText = (@"Last Sync : %d", [NSDate date]); | |
[syncDate setStringValue:dateText]; | |
NSEntityDescription *entityDescription = [NSEntityDescription |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)outlineView:(NSOutlineView *)outlineView | |
willDisplayCell:(id)cell | |
forTableColumn:(NSTableColumn *)tableColumn | |
item:(id)item { | |
NSColor *color = [cell backgroundColor]; | |
NSLog(@"Colorizing Method B"); | |
if (clicked == YES) { | |
if (color == [NSColor lightGrayColor]) { | |
}else{ | |
[cell setBackgroundColor:[NSColor lightGrayColor]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"touchDown"); | |
UITouch *touch = [touches anyObject]; | |
firstTouch = [touch locationInView:self.view]; | |
lastTouch = [touch locationInView:self.view]; | |
[self.view setNeedsDisplay]; | |
} | |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { | |
UITouch *touch = [touches anyObject]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"touchDown"); | |
UITouch *touch = [touches anyObject]; | |
firstTouch = [touch locationInView:self.view]; | |
} | |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSArray *array = [touches allObjects]; | |
UITouch *specificTouch = [array objectAtIndex:0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
NSLog(@"touchDown"); | |
UITouch *touch = [touches anyObject]; | |
UIView *aView = [self.view viewWithTag:1]; | |
firstTouch = [touch locationInView:self.view]; | |
if (CGRectContainsPoint(aView.frame, firstTouch)) { | |
butContains = YES; | |
NSLog(@"butContains = %d", butContains); | |
} | |
} |
OlderNewer