iOS UIAlertController 文字左对齐

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:UIAlertControllerStyleAlert];

    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

        

    }];

    

    [alertController addAction:action1];

    UIView *subView1 = alertController.view.subviews[0];

    UIView *subView2 = subView1.subviews[0];

    UIView *subView3 = subView2.subviews[0];

    UIView *subView4 = subView3.subviews[0];

    UIView *subView5 = subView4.subviews[0];

    UILabel *title = subView5.subviews[0];

    UILabel *message = subView5.subviews[1];

    message.textAlignment = NSTextAlignmentLeft;

    UIViewController *rootVC = [[UIApplication sharedApplication]delegate].window.rootViewController;

    [rootVC presentViewController:alertController animated:YES completion:nil];

你可能感兴趣的:(iOS)