I need to programmatically make some labels and text fields. I can get there.
NSTextField* newFileNameLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(objXPos, objYPos, 300.0, 20.0)];
[newFileNameLabel setBordered: NO];
[newFileNameLabel setTextColor: [NSColor whiteColor]];
[newFileNameLabel setDrawsBackground:NO];
[newFileNameLabel setEditable:NO];
[newFileNameLabel setStringValue: @"File Name:"];
[vSheetView addSubview:newFileNameLabel];
But I could not find anything in the documents that would allow me to set the wrap property. In IB, a property is a layout with "scroll, wrap, and truncate" options. NSTextField has no way to set this, and if I go to the inheritance chain, neither NSControl. NSView has a setNeedsLayout method, but it does not seem to be related:
You only ever need to invoke this method if your view implements custom layout
not expressible in the constraint-based layout system by overriding the layout method.
The system invokes this method automatically for all views using constraints for layout.
NSTextFieldCell also has no methods. Any help would be greatly appreciated.
source
share