Last active
December 29, 2015 21:19
-
-
Save mashhoodr/7729351 to your computer and use it in GitHub Desktop.
A snippet for styling the NSTextfields properly [http://imars.info/styling-nstextfields-cocoa-development/]
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)drawWithFrame:(NSRect)cellFrame | |
inView:(NSView *)controlView { | |
NSImage *img = [NSImage imageNamed:@"tf"]; | |
[img drawAtPoint:NSPointFromCGPoint(CGPointMake(0, 0)) | |
fromRect:NSZeroRect | |
operation:NSCompositeSourceOver | |
fraction:1]; | |
cellFrame.origin.x += 10; | |
cellFrame.origin.y += 16; | |
[super drawWithFrame:cellFrame inView:controlView]; | |
} | |
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView | |
editor:(NSText *)textObj | |
delegate:(id)anObject | |
start:(NSInteger)selStart | |
length:(NSInteger)selLength { | |
aRect.origin.x += 10; | |
aRect.origin.y += 16; | |
[super selectWithFrame:aRect inView:controlView editor:textObj delegate:anObject start:selStart length:selLength]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment