-
-
Save chamons/3d563be02f37ba7b5ed5 to your computer and use it in GitHub Desktop.
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
// | |
// ViewController.m | |
// MouseDownTest | |
// | |
// Created by Chris Hamons on 12/4/14. | |
// Copyright (c) 2014 Chris Hamons. All rights reserved. | |
// | |
#import "ViewController.h" | |
@interface MyView : NSView | |
@end | |
@implementation MyView | |
- (void) mouseDown:(NSEvent *)theEvent { | |
NSLog (@"Down"); | |
[super mouseDown:theEvent]; | |
} | |
- (void) drawRect:(NSRect)dirtyRect { | |
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort]; | |
CGContextSetRGBFillColor (context, 1, 0, 0, 1); | |
CGContextFillRect(context, dirtyRect); | |
} | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
MyView * view = [MyView new]; | |
view.frame = CGRectMake(10, 10, 100, 100); | |
[[self view] addSubview:view]; | |
// Do any additional setup after loading the view. | |
} | |
- (void)setRepresentedObject:(id)representedObject { | |
[super setRepresentedObject:representedObject]; | |
// Update the view, if already loaded. | |
} | |
@end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment