Dic*_*dia 4 xcode objective-c hyphen uilabel ios
是否有正字连字词的方法?
像这样的东西:
NSStiring *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.";
UILabel *label = [[UILabel alloc] init];
label.text = string;
Run Code Online (Sandbox Code Playgroud)
如果框架UILabel将变窄,请进入下一步:
在2010年6月在
万维网
开发CON-
扰,苹果
宣布版本-
的Xcode 4锡永
在德弗尔期间
OPER工具国家
联盟AD-的
礼服.
目标-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;
Run Code Online (Sandbox Code Playgroud)
斯威夫特 4
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.hyphenationFactor = 1.0
let attributedString = NSMutableAttributedString(string: "Your String", attributes: [NSAttributedStringKey.paragraphStyle:paragraphStyle])
self.yourLabel.attributedText = attributedString
Run Code Online (Sandbox Code Playgroud)
斯威夫特 3
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.hyphenationFactor = 1.0
let attributedString = NSMutableAttributedString(string: "Your String", attributes: [NSParagraphStyleAttributeName:paragraphStyle])
self.yourLabel.attributedText = attributedString
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2808 次 |
| 最近记录: |