I have a subclass of NSTextField and I setting the LineBreakMode.
It works fine under my mac with Yosemite and Crashes for one of my users on Mavericks
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[XTextField setLineBreakMode:]: unrecognized selector sent to instance 0x7fc784548ad0'
How could I work this round ?
Header File of the subclass
#import <Cocoa/Cocoa.h>
@interface XTextField : NSTextField
- (void)setText:(NSString *)text
@end
Implementation
#import "XTextField.h"
@implementation XTextField
- (void)setText:(NSString *)text
{
if (text)
{
[self setStringValue:text];
}
else
{
[self setStringValue:@""];
}
}
- (instancetype)initWithFrame:(NSrect)frame
{
if(self = [super initWithFrame:frame])
{
[self setEditable:NO];
[self setSelectable:NO];
[self setDrawsBackGround:NO];
[self setBezeled:NO];
}
return self;
}
@end
Calling code:
XTextField* myLabel = [[XTextField alloc]initWithFrame:myFrame];
[myLabel settext:@"text text text"];
[myLabel setLineBreakMode:NSLineBreakByTruncatingTail];