我现在使用Xcode 4.5和iOS6,iOS6改变了UILabel文本对齐方式,
label.textAlignment = NSTextAlignmentJustified;
该代码将在带有 ios6 SDK 的 iPhone 6.0 模拟器上崩溃。但在带有 iOS6 SDK 的 iPhone 5.0 模拟器上不会崩溃。
iOS 6支持NSTextAlignment Justified,但是为什么会崩溃呢?
Edit 1:
Using NSAttributedString
我们可以证明文本合理。
NSMutableParagraphStyle *paragraphStyles = [[NSMutableParagraphStyle alloc] init];
paragraphStyles.alignment = NSTextAlignmentJustified;
paragraphStyles.firstLineHeadIndent = 0.05; // Very IMP
NSString *stringTojustify = @"We are what our thoughts have made us; so take care about what you think. Words are secondary. Thoughts live; they travel far.";
NSDictionary *attributes = @{NSParagraphStyleAttributeName: paragraphStyles};
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:stringTojustify attributes:attributes];
self.lblQuote.attributedText = attributedString;
self.lblQuote.numberOfLines = 0;
[self.lblQuote sizeToFit];
![enter image description here](https://i.stack.imgur.com/KdCml.png)
弃用UITextAlignmentJustify
,在 iOS 6 下不再可用。
此处给出了所有可能的合理文本解决方案SO link还
看一下这一页 and iOS6 预发布文档.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)