如题, UIAlertController 的文案居左显示,左对齐。代码如下
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"温馨提示比较长" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *actionC = [UIAlertAction actionWithTitle:@"已确定并知悉该事项" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[NSUserDefaults standardUserDefaults] setValue:@"hadshow" forKey:@"showNotSupportFastRedeem"];
}];
// 设置左对齐
///设置左对齐
// UILabel *label1 = [alertVC.view valueForKeyPath:@"_titleLabel"];
UILabel *label2 = [alertController.view valueForKeyPath:@"_messageLabel"];
if (label2) {
// label1.textAlignment = NSTextAlignmentLeft;
label2.textAlignment = NSTextAlignmentLeft;
}
[alertController addAction:actionC];
[self presentViewController:alertController animated:YES completion:nil];
网友评论