Answer the question
In order to leave comments, you need to log in
How to implement multi-line (multi-line) in NSTokenField?
I want to implement multi-line NSTokenFiels. That is, so that the input characters or tokens, when they reach the border of the input field, are transferred to a new line and the height of the NSTokenField is stretched so that all lines are visible, for example:
I found on the Internet a way to implement multiline using the delegate methodcontrolTextDidChange:
- (void)controlTextDidChange:(NSNotification *)obj {
NSRect oldTokenFieldFrame = [formatTokenField frame];
NSSize cellSize = ;
NSLog(@"%s cell width: %f cell height: %f", __func__, cellSize.width, cellSize.height);
NSLog(@"%s frame width: %f frame height: %f", __func__, oldTokenFieldFrame.size.width, oldTokenFieldFrame.size.height);
[formatTokenField setFrame:NSMakeRect(oldTokenFieldFrame.origin.x,
oldTokenFieldFrame.origin.y + oldTokenFieldFrame.size.height - cellSize.height,
oldTokenFieldFrame.size.width,
cellSize.height)];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question