Orthographic hyphenation word in IOS
Use an NSAttributedString with an NSParagraphStyle with a hyphenationFactor
of 1.
Objective-C
NSString *string = @"In June 2010 at the World Wide Developers Conference, Apple announced version 4 of Xcode during the Developer Tools State of the Union address.";
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.hyphenationFactor = 1.0;
NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:string];
UILabel *label = [[UILabel alloc] init];
label.attributedText = attributedString;
Swift 4
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.hyphenationFactor = 1.0
let attributedString = NSMutableAttributedString(string: "Your String", attributes: [NSAttributedStringKey.paragraphStyle:paragraphStyle])
self.yourLabel.attributedText = attributedString
Swift 3
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.hyphenationFactor = 1.0
let attributedString = NSMutableAttributedString(string: "Your String", attributes: [NSParagraphStyleAttributeName:paragraphStyle])
self.yourLabel.attributedText = attributedString