I create transparent NSTextField
self.myTextField = [[NSTextField alloc] initWithFrame:CGRectMake(backgroundView.frame.origin.x + backgroundView.frame.size.width + 20, self.projectTitle.frame.origin.y - 30.0, 100, 20)]; self.myTextField.editable = NO; self.myTextField.bezeled = NO; self.myTextField.drawsBackground = YES; self.myTextField.backgroundColor = [NSColor clearColor]; self.myTextField.selectable = NO; self.myTextField.font = [NSFont fontWithName:@"Helvetica Neue" size:16]; [self addSubview:self.compressingTime];
And as a result text look bad. If I set background color
self.myTextField.backgroundColor = [NSColor colorWithCalibratedRed:0.85 green:0.85 blue:0.85 alpha:1.0];
everything looks ok I have also tried with drawsBackground = NO;
Do you guys know how to fix this?
The secret is setting ALL THREE of these properties on the NSTextField
...
myTextField.bezeled = NO; myTextField.editable = NO; myTextField.drawsBackground = NO;
There is a property in the .xib file, on the interface builder window for the text field, under attribute inspector
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With