iOS 修改UIAlertController的按钮字体颜色

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

        

        

        //修改按钮的颜色

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

         

        }];

        [suresetValue:[UIColorredColor]forKey:@"_titleTextColor"];

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

            

        }];

        [canclesetValue:[UIColorredColor]forKey:@"_titleTextColor"];

        [alertaddAction:sure];

        [alertaddAction:cancle];

        

        [selfpresentViewController:alertanimated:truecompletion:nil];


效果图:



版权声明:本文为qq_27820359原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。