-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMyListView.m
51 lines (40 loc) · 1.25 KB
/
MyListView.m
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
46
47
48
49
50
51
//
// MyListView.m
// Gallery
//
// Created by David Kapp on 2/27/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "MyListView.h"
#import "MyMainWindow.h"
#import "MyPhoto.h"
#import "MyEditorView.h"
@implementation MyListView
@synthesize mainWindowController;
@synthesize imagesTable;
@synthesize imagesArrayController;
- (void) loadView {
[super loadView];
self.imagesTable.target = self;
self.imagesTable.doubleAction = @selector(tableViewItemDoubleClicked:);
}
- (IBAction) tableViewItemDoubleClicked:(id)sender {
NSInteger row = self.imagesTable.clickedRow;
NSArray *visiblePhotos = [self.imagesArrayController arrangedObjects];
MyPhoto *photo = [visiblePhotos objectAtIndex:row];
MyMainWindow *window = self.mainWindowController;
id editor = [window viewControllerForName:@"MyEditorView"];
if ([editor isKindOfClass:[MyEditorView class]]) {
[(MyEditorView*)editor editPhoto:photo];
}
else {
NSLog(@"Tried to open an editor from tableViewItemDoubleClicked but got object of class %@",
NSStringFromClass([editor class]));
}
}
- (void) dealloc {
self.imagesTable = nil;
self.imagesArrayController = nil;
[super dealloc];
}
@end