NSTextField doesn't display text
Posted
by
Alexsander Akers
on Stack Overflow
See other posts from Stack Overflow
or by Alexsander Akers
Published on 2011-01-05T00:51:40Z
Indexed on
2011/01/05
0:53 UTC
Read the original article
Hit count: 230
The NSTextField
has a superview and a frame. It is fully visible and has the following declaration:
- (id) initWithFrame: (NSRect) frameRect {
if ((self = [super initWithFrame: NSMakeRect(0, 0, 300, 20)])) {
label = [[NSTextField alloc] initWithFrame: NSMakeRect(47, 1, 233, 18)];
[[label cell] setAllowsUndo: NO];
[[label cell] setLineBreakMode: NSLineBreakByTruncatingMiddle];
[[label cell] setScrollable: NO];
[label setBezeled: NO];
[label setBordered: NO];
[label setDrawsBackground: NO];
[label setEditable: NO];
[label setFont: [NSFont menuFontOfSize: 14.0f]];
[label setSelectable: NO];
[label setTextColor: [NSColor textColor]];
[self addSubview: label];
NSLog(@"%@", NSStringFromRect([label visibleRect]));
}
return self;
}
© Stack Overflow or respective owner