Pete.Mertz
Pete.Mertz

Reputation: 1301

NSParagraphStyle hypenationFactor not working

I'm trying to full justify and allow for hyphenation in an NSAttributedString. Right now I set the paragraph style using the code:

NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
paragraph.alignment = NSTextAlignmentJustified;
paragraph.hyphenationFactor = 0.5;
paragraph.lineBreakMode = NSLineBreakByWordWrapping;

This doesn't hyphenate, it just splits words based on how much they fit. I've also tried NSLineBreakByCharWrapping which ends up being even worse. Any ideas? I'm using the iOS 6 libraries.

Thanks, Pete

Upvotes: 1

Views: 1334

Answers (1)

Pete.Mertz
Pete.Mertz

Reputation: 1301

Recently found this out:

There is a bug in the library, in that any value BETWEEN 0.0 and 1.0 does not work. That being said, the values 0.0 and 1.0 DO work. So to get hyphenation, set the hyphenation factor to 1.0 as of iOS6.

Upvotes: 2

Related Questions