如題错维, UIAlertController 的文案居左顯示,左對齊橄唬。代碼如下
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"溫馨提示" message:@"溫馨提示比較長" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *actionC = [UIAlertAction actionWithTitle:@"已確定并知悉該事項(xiàng)" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[NSUserDefaults standardUserDefaults] setValue:@"hadshow" forKey:@"showNotSupportFastRedeem"];
}];
// 設(shè)置左對齊
///設(shè)置左對齊
// 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];