UIAlertController 文案居左,左对齐

如题, 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];
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 夜莺2517阅读 127,749评论 1 9
  • 版本:ios 1.2.1 亮点: 1.app角标可以实时更新天气温度或选择空气质量,建议处女座就不要选了,不然老想...
    我就是沉沉阅读 6,939评论 1 6
  • 我是黑夜里大雨纷飞的人啊 1 “又到一年六月,有人笑有人哭,有人欢乐有人忧愁,有人惊喜有人失落,有的觉得收获满满有...
    陌忘宇阅读 8,587评论 28 53
  • 兔子虽然是枚小硕 但学校的硕士四人寝不够 就被分到了博士楼里 两人一间 在学校的最西边 靠山 兔子的室友身体不好 ...
    待业的兔子阅读 2,627评论 2 9