iOS UIAlertController alert中内容居

作者: Sxiaobai | 来源:发表于2019-07-30 14:23 被阅读0次
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"本次升级说明" message:info preferredStyle:(UIAlertControllerStyleAlert)];
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
paraStyle.alignment = NSTextAlignmentLeft;
NSMutableAttributedString *atrStr = [[NSMutableAttributedString alloc] initWithString:info attributes:@{NSParagraphStyleAttributeName:paraStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0]}];

[alert setValue:atrStr forKey:@"attributedMessage"];
UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
   //
}];
[alert addAction:action];
[self presentViewController:alert animated:YES completion:nil];
左对齐demo.png

相关文章

网友评论

    本文标题:iOS UIAlertController alert中内容居

    本文链接:https://www.haomeiwen.com/subject/gnfnrctx.html