正文
UIAlertController 标题文字大小 颜色
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
NSString *title = [NSString stringWithFormat:@"\n恭喜您获得%d个红包\n", ];
NSString *msg = @"\n把红包分享给微信好友,金额随机,可用于购买雪票和雪卡";
UIAlertController * alert = [UIAlertController alertControllerWithTitle:title
message:msg
preferredStyle:UIAlertControllerStyleActionSheet];
// titile字号处理
NSMutableAttributedString *hogan = [[NSMutableAttributedString alloc] initWithString:title];
[hogan addAttribute:NSFontAttributeName
value:[UIFont systemFontOfSize:20.0]
range:NSMakeRange(, title.length)];
[alert setValue:hogan forKey:@"attributedTitle"];
// UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"给好友发红包" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self shareAction];
}];
[alert addAction:sureAction]; alert.view.tintColor = APP_MAIN_COLOR;
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消"
style:UIAlertActionStyleCancel
handler:nil];
[alert addAction:cancelAction]; [self presentViewController:alert animated:YES completion:nil];