forked from PureLayout/PureLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathALMacAppDelegate.m
More file actions
47 lines (37 loc) · 1.26 KB
/
ALMacAppDelegate.m
File metadata and controls
47 lines (37 loc) · 1.26 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
46
47
//
// ALMacAppDelegate.m
// PureLayout Example-Mac
//
// Copyright (c) 2014 Tyler Fox
// https://github.com/smileyborg/PureLayout
//
#import "ALMacAppDelegate.h"
#import "ALMacViewController.h"
@interface ALMacAppDelegate ()
@property (weak, nonatomic) IBOutlet NSWindow *window;
@property (strong, nonatomic) ALMacViewController *viewController;
@end
@implementation ALMacAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
self.viewController = [[ALMacViewController alloc] initWithNibName:nil bundle:nil];
self.viewController.view.frame = CGRectMake(0, 0, CGRectGetWidth(self.window.frame), CGRectGetHeight(self.window.frame));
[self.window.contentView addSubview:self.viewController.view];
[self.window makeFirstResponder:self];
self.window.delegate = self;
}
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
// Insert code here to tear down your application
}
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
{
self.viewController.view.frame = CGRectMake(0, 0, frameSize.width, frameSize.height);
return frameSize;
}
- (void)keyDown:(NSEvent *)theEvent
{
// Press any key to advance to the next demo
[self.viewController nextDemo];
}
@end