I understand the NSButton guidelines for setting title to NSButton, No offence but the requirement should be fulfilled in my case.
I want to show NSButton title in two lines.
NSButton *btn = [[NSButton alloc] init];
[btn setTitle:@"multiple line text if longer title"];
the result I wanted was kind of below -:
I have fulfilled the requirement by subclassing the NSButton and then checked the title's string length to divide string accordingly to show it in two line.
NSArray *arrStr = [str componentsSeparatedByString:@" "];
NSString *strTemp = @"";
if(arrStr.count>1){
strTemp = [NSString stringWithFormat:@"%@\n%@", arrStr.firstObject, [str stringByReplacingOccurrencesOfString:arrStr.firstObject withString:@""]];
}
else{
strTemp = str;
}
NSMutableAttributedString* attributedString = [[NSMutableAttributedString alloc] initWithString:strTemp];