iOS归纳iOS开发中遇到的bug和小技巧汇总

iOS UIAlertController alert中内容居

2019-07-30  本文已影响0人  Sxiaobai
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
上一篇下一篇

猜你喜欢

热点阅读