Tag: nsparagraphstyle

NSTextAlignmentCenter和NSTextAlignmentRight在NSTextTab中是错误的?

任何人都可以请检查我的东西…只是为了确保我不会生气! 我用tabStops创build了一个NSMutableParagraphStyle ,但是他们并没有出现在我期待的地方: float width = self.myLabel.frame.size.width; self.tabStyle.tabStops = @[[[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentRight location:width – 50 options:nil], [[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentRight location:width options:nil]]; 然后我创build了一个方便的方法,用两个string的标签位置创build一个属性string: – (NSAttributedString *)tabbedTextWithFirstString:(NSString *)firstString secondString:(NSString *)secondString { NSDictionary *attributes = @{NSFontAttributeName:[UIFont fontWithName:kHSTFontFaceDefault size:14.0]}; NSString *tabbedStr = [NSString stringWithFormat:@"\t%@\t", firstString]; NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:tabbedStr attributes:attributes]; attributes = @{NSFontAttributeName:[UIFont fontWithName:kHSTFontFaceDefaultBold size:14.0]}; [attrStr appendAttributedString:[[NSAttributedString […]

在UILabel的单词中添加连字符

如何设置一个UILabel lineBreakMode打破单词并添加连字符到破碎的单词? 一个破碎的wo- rd应该看起来像这样