iOS 修改UIAlertController的按钮字体颜色

来源:互联网 发布:vb教程ppt 编辑:程序博客网 时间:2024/05/16 07:41

      UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:@"确定要删除这个作品吗?"message:nilpreferredStyle:UIAlertControllerStyleAlert];

        

        

        //修改按钮的颜色

        UIAlertAction *sure = [UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *_Nonnull action) {

         

        }];

        [sure setValue:[UIColorredColor]forKey:@"_titleTextColor"];

        UIAlertAction *cancle = [UIAlertActionactionWithTitle:@"取消"style:UIAlertActionStyleCancelhandler:^(UIAlertAction *_Nonnull action) {

            

        }];

        [cancle setValue:[UIColorredColor]forKey:@"_titleTextColor"];

        [alert addAction:sure];

        [alert addAction:cancle];

        

        [selfpresentViewController:alertanimated:truecompletion:nil];


效果图:


0 0