Created
June 18, 2013 19:44
-
-
Save aspitz/5808624 to your computer and use it in GitHub Desktop.
Category code to position a window based on the upper right hand corner of the screen
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 "NSWindow+Utilities.h" | |
@implementation NSWindow (Utilities) | |
- (void)setTopLeftRelativeToMainScreen:(CGPoint)topLeftPt{ | |
CGRect mainScreenVisibleFrame = NSScreen.mainScreen.visibleFrame; | |
CGPoint pt = CGPointZero; | |
pt.x = topLeftPt.x; | |
pt.y = mainScreenVisibleFrame.origin.y + mainScreenVisibleFrame.size.height - topLeftPt.y; | |
[self setFrameTopLeftPoint:pt]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment