一个失败的简单测试:创建一个只有一个子视图(UITextView)的新项目并将以下内容放入:
- (void)viewDidLoad
{
[super viewDidLoad];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineHeightMultiple = 50.f;
paragraphStyle.lineSpacing = 100.f;
paragraphStyle.minimumLineHeight = 200.f;
paragraphStyle.maximumLineHeight = 500.f;
UIFont *font = [UIFont fontWithName:@"AmericanTypewriter" size:24.f];
self.textView.attributedText = [[NSAttributedString alloc] initWithString:
@"This is a test.\n Will I pass?" attributes:
@{NSParagraphStyleAttributeName : paragraphStyle, NSFontAttributeName : font}];
}
行间距与该属性不存在时相同。有什么东西可以成功吗?我输入荒谬的数字只是为了表明它不会改变......