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
#import <Foundation/Foundation.h> | |
#import <CoreLocation/CoreLocation.h> | |
typedef void (^JWLocationManagerCallback)(CLLocation *location); | |
typedef void (^JWLocationManagerErrorCallback)(NSError *error); | |
@interface JWLocationManager : NSObject <CLLocationManagerDelegate> | |
@property (nonatomic, copy) NSString *purpose; | |
@property (nonatomic, copy) JWLocationManagerCallback locationUpdatedBlock; |
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
@implementation NSView (Animations) | |
- (void)addSubview:(NSView *)aView animated:(BOOL)animated { | |
[aView setAlphaValue:0.f]; | |
[aView setFrameOrigin:NSZeroPoint]; | |
CGFloat duration = animated ? (([[[self window] currentEvent] modifierFlags] & NSShiftKeyMask) ? 1.f : 0.25f ) : 0.f; | |
[NSAnimationContext beginGrouping]; | |
[[NSAnimationContext currentContext] setDuration:duration]; | |
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)resizeWindowForContentSize:(NSSize)size animated:(BOOL)animated { | |
NSRect windowFrame = [self contentRectForFrameRect:[self frame]]; | |
NSRect newWindowFrame = [self frameRectForContentRect: | |
NSMakeRect( NSMinX( windowFrame ), NSMaxY( windowFrame ) - size.height, size.width, size.height )]; | |
[self setFrame:newWindowFrame display:YES animate:animated]; | |
} |
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)drawInRect:(CGRect)rect { | |
CGSize shadowOffset = CGSizeMake(0, -1); | |
float colorValues[] = {0, 0, 0, .9}; | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGContextSaveGState(ctx); | |
CGContextSetShadow (ctx, shadowOffset, 1); | |
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
CGColorRef color = CGColorCreate(colorSpace, colorValues); |
NewerOlder