I want to add a button to my application in the NSTokenField field, for example something like this:
Ie, in NSTokenField there is a plus button that should perform some action, for example a pop-up menu with a choice of tokens that can be added to the NSTokenField field.
I created the button programmatically and added it to the NSTokenField:
NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect(185, -1, 19, 24)]; [button setTitle:@"<"]; [button setFont:[NSFont menuFontOfSize:[NSFont smallSystemFontSize]]]; [button setButtonType:NSMomentaryPushInButton]; [button setBezelStyle:NSSmallSquareBezelStyle]; [button setTarget:self]; [button setAction:@selector(action:)]; [formatTokenField addSubview:button]; The button was added normally:
but when I try to enter characters in the NSTokenField the input area overlaps my button:
Please help me figure out how to add buttons to the NSTokenField correctly and what needs to be done so that the input area does not overlap the added buttons (could you give some code examples). Thank you all in advance.





