using explicit setters instead of bindings for selection

This commit is contained in:
michael starke
2016-02-25 15:48:07 +01:00
parent 627d48a74e
commit 06c5f4d740

View File

@@ -104,12 +104,9 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
[self.view layout]; [self.view layout];
/* Init edit and cancel buttons */
self.editButton.action = @selector(beginEditing:);
self.cancelEditButton.action = @selector(cancelEditing:);
self.cancelEditButton.hidden = YES; self.cancelEditButton.hidden = YES;
[self _toggleEditors:NO]; [self _establishBindings];
} }
- (void)registerNotificationsForDocument:(MPDocument *)document { - (void)registerNotificationsForDocument:(MPDocument *)document {
@@ -119,10 +116,6 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
object:document]; object:document];
[self.entryViewController registerNotificationsForDocument:document]; [self.entryViewController registerNotificationsForDocument:document];
[self.nodeController bind:NSContentBinding toObject:document withKeyPath:NSStringFromSelector(@selector(selectedItem)) options:nil];
[self _establishBindings];
[self.entryViewController setupBindings:document]; [self.entryViewController setupBindings:document];
[self.groupViewController setupBindings:document]; [self.groupViewController setupBindings:document];
} }
@@ -284,8 +277,9 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
else { else {
self.activeTab = MPEmptyTab; self.activeTab = MPEmptyTab;
} }
self.nodeController.content = document.selectedItem;
[self _establishBindings]; self.entryViewController.representedObject = document.selectedItem.asEntry;
self.groupViewController.representedObject = document.selectedItem.asGroup;
} }
- (IBAction)beginEditing:(id)sender { - (IBAction)beginEditing:(id)sender {