MSAlertController

You can use AlertController in iOS7!! 你可以在iOS中使用AlertController了

MSAlertController has same feature at UIAlertViewController. MSAlertController有着与UIAlertViewController一样的特性

  • Alert
  • ActionSheet

In addtion, customize font, font size and font color.

另外,他还可以自定义字体,以及字体颜色。

 

Usage - 使用

To run the example project, clone the repo, and run pod install from the Example directory first.

为了运行这个应用程序,复制repo,然后运行pod进行安装即可。

For Alert 用于Alert

Set MSAlertControllerStyleAlert to preferredStyle.

将MSAlertControllerStyleAlert设置到预定样式。

    MSAlertController *alertController = [MSAlertController alertControllerWithTitle:@"MSAlertController" message:@"This is MSAlertController." preferredStyle:MSAlertControllerStyleAlert]; MSAlertAction *action = [MSAlertAction actionWithTitle:@"Cancel" style:MSAlertActionStyleCancel handler:^(MSAlertAction *action) { //Write a code for this action. }]; [alertController addAction:action]; MSAlertAction *action2 = [MSAlertAction actionWithTitle:@"Destructive" style:MSAlertActionStyleDestructive handler:^(MSAlertAction *action) { //Write a code for this action. }]; [alertController addAction:action2]; MSAlertAction *action3 = [MSAlertAction actionWithTitle:@"Default" style:MSAlertActionStyleDefault handler:^(MSAlertAction *action) { //Write a code for this action. }]; [alertController addAction:action3]; [self presentViewController:alertController animated:YES completion:nil]; 

For Action Sheet 用于Action Sheet

Set MSAlertControllerStyleActionSheet to preferredStyle.

将MSAlertControllerStyleActionSheet设定成预定样式。

    MSAlertController *alertController = [MSAlertController alertControllerWithTitle:@"MSAlertController" message:@"This is MSAlertController." preferredStyle:MSAlertControllerStyleActionSheet]; MSAlertAction *action = [MSAlertAction actionWithTitle:@"Cancel" style:MSAlertActionStyleCancel handler:^(MSAlertAction *action) { //Write a code for this action. }]; [alertController addAction:action]; MSAlertAction *action2 = [MSAlertAction actionWithTitle:@"Destructive" style:MSAlertActionStyleDestructive handler:^(MSAlertAction *action) { //Write a code for this action. }]; [alertController addAction:action2]; MSAlertAction *action3 = [MSAlertAction actionWithTitle:@"Default" style:MSAlertActionStyleDefault handler:^(MSAlertAction *action) { //Write a code for this action. }]; [alertController addAction:action3]; [self presentViewController:alertController animated:YES completion:nil]; 

Customization - 定制

For Action Controller - 对于Action Controller

@property (strong, nonatomic) UIColor *titleColor;
@property (strong, nonatomic) UIFont *titleFont;
@property (strong, nonatomic) UIColor *messageColor;
@property (strong, nonatomic) UIFont *messageFont;
@property (assign, nonatomic) BOOL enabledBlurEffect;
@property (strong, nonatomic) UIColor *backgroundColor;
@property (assign, nonatomic) CGFloat alpha;
@property (strong, nonatomic) UIColor *alertBackgroundColor;
@property (strong, nonatomic) UIColor *separatorColor;

MSAlertController *alertController = [MSAlertController alertControllerWithTitle:@"MSAlertController" message:@"This is MSAlertController." preferredStyle:MSAlertControllerStyleAlert]; alertController.titleColor = [UIColor blueColor]; alertController.titleFont = [UIFont fontWithName:@"Baskerville-BoldItalic" size:20.0f]; alertController.messageColor = [UIColor greenColor]; alertController.messageFont = [UIFont fontWithName:@"Baskerville-BoldItalic" size:18.0f];

For Action - 对于Action

@property (strong, nonatomic) UIColor *titleColor;
@property (strong, nonatomic) UIFont *font;
@property (strong, nonatomic) UIColor *normalColor;
@property (strong, nonatomic) UIColor *highlightedColor;

MSAlertAction *action = [MSAlertAction actionWithTitle:@"Cancel" style:MSAlertActionStyleCancel handler:^(MSAlertAction *action) { //Write a code for this action. }]; action.titleColor = [UIColor redColor]; action.font = [UIFont fontWithName:@"Baskerville-BoldItalic" size:18.0f]; [alertController addAction:action];

Combination - 组合样式

    MSAlertController *alertController = [MSAlertController alertControllerWithTitle:@"MSAlertController" message:@"This is MSAlertController." preferredStyle:MSAlertControllerStyleAlert]; alertController.alertBackgroundColor = [UIColor lightGrayColor]; alertController.backgroundColor = [UIColor blueColor]; alertController.alpha = 0.3f; alertController.separatorColor = [UIColor redColor]; MSAlertAction *action = [MSAlertAction actionWithTitle:@"Cancel" style:MSAlertActionStyleCancel handler:^(MSAlertAction *action) { NSLog(@"Cancel action tapped %@", action); }]; action.normalColor = [UIColor blackColor]; action.highlightedColor = [UIColor yellowColor]; [alertController addAction:action]; MSAlertAction *action2 = [MSAlertAction actionWithTitle:@"Destructive" style:MSAlertActionStyleDestructive handler:^(MSAlertAction *action) { NSLog(@"Destructive action tapped %@", action); }]; [alertController addAction:action2]; MSAlertAction *action3 = [MSAlertAction actionWithTitle:@"Default" style:MSAlertActionStyleDefault handler:^(MSAlertAction *action) { NSLog(@"Default action tapped %@", action); }]; action3.normalColor = [UIColor darkGrayColor]; action3.highlightedColor = [UIColor whiteColor]; [alertController addAction:action3]; [alertController addTextFieldWithConfigurationHandler:nil]; [self presentViewController:alertController animated:YES completion:nil];

Action Sheet is compatible with same customization.

Action Sheet可以自由定制。

Requirements - 需要的环境

  • iOS 7.0 and greater iOS7.0或者更高
  • ARC ARC
  • QuartzCore.framework QuartzCore框架

Installation - 安装

MSAlertController is available through CocoaPods. To install it, simply add the following line to your Podfile:

CocoaPods中已经可以添加MSAlertController了,要安装他,简单执行下面一句话即可:

pod "MSAlertController"

[翻译] MSAlertController相关推荐

  1. Mysql函数group_concat、find_in_set 多值分隔字符字段进行数据库字段值翻译

    Mysql函数group_concat.find_in_set进行数据库字段值翻译 场景 配方表:记录包含的原料 sources表示原料,字段值之间用逗号分隔 原料表:对应原料id和原料名称 现需要查 ...

  2. “Attention is All You Need 翻译

    <p><img src="output_0_0.png" alt="png"></p> "Attention is ...

  3. 基于PyTorch的Seq2Seq翻译模型详细注释介绍(一)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/qysh123/article/deta ...

  4. 全文翻译(全文合集):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

    全文翻译(全文合集):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 摘要 人们越来越需要将机器学习应用到各种各样 ...

  5. 全文翻译(四) TVM An Automated End-to-End Optimizing Compiler

    全文翻译(四) TVM An Automated End-to-End Optimizing Compiler 6.3 嵌入式GPU评估 对于移动GPU实验,在配备ARM Mali-T860MP4 G ...

  6. 全文翻译(三) TVM An Automated End-to-End Optimizing Compiler

    全文翻译(三) TVM An Automated End-to-End Optimizing Compiler 5. 自动化优化 考虑到一组丰富的调度原语,剩下的问题是为DL模型的每一层,找到最佳的算 ...

  7. 全文翻译(二): TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

    全文翻译(二): TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 3.优化计算图 计算图是在DL框架中表示程序的常 ...

  8. 全文翻译(一):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning

    全文翻译(一):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 摘要 人们越来越需要将机器学习应用到各种各样的硬件 ...

  9. YOLOv4全文阅读(全文中文翻译)

    YOLOv4全文阅读(全文中文翻译) YOLOv4: Optimal Speed and Accuracy of Object Detection 论文链接: https://arxiv.org/pd ...

  10. Ubuntu 划词翻译

    在 Windows 下用 QTranslate 可以划词翻译,调用谷歌或百度翻译引擎,不需要本地词典. 在 Ubuntu 下可以自己写脚本实现一个简陋的版本. 步骤如下: 安装 xsel,sudo a ...

最新文章

  1. python嵌套循环效率_Python嵌套循环数组比较优化的可能性?
  2. sumif三个条件怎么填_Excel条件求和函数sumif详解及应用
  3. Gradle中的buildScript代码块
  4. oracle增删控制文件,控制文件的增删改及备份
  5. 5G NR 链路自适应 Link Adaptation
  6. Image Segmentation(图像分割)网络结构比较
  7. javascript 中==和===的区别
  8. 数字图像处理(冈萨雷斯 第三版)
  9. 【Android工具】更新Yandex网页剪辑插件测试!可以安装PCchrome插件的手机浏览器!...
  10. kotlin数组和集合
  11. pq磁盘分区工具的初次使用
  12. Java 基础学习之字符串的简单操作和适配器设计模式
  13. 微信公众号(八)——关注时自动回复(文字 图片)
  14. android图片显示组件,Android可循环显示图像的Android Gallery组件用法实例
  15. python雷达图详解_Python基础教程 - matplotlib实现雷达图和柱状图
  16. 2021年奥利给好看高考倒计时源码
  17. 一 贷款基础指标介绍
  18. 《生物信息学:导论与方法》--生物信息数据库及软件资源--听课笔记(二十二)
  19. Mysql递归调用,报错:Subquery returns more than 1 row
  20. 蓝桥杯 蓝肽子序列 python(2020动态规划)

热门文章

  1. 自学python入门训练营 李笑来_如何看待李笑来发布的Python教程《自学是门手艺》?...
  2. datatables java 分页_DataTables后台分页的使用
  3. 提交不了_志愿提交不了,不一定是系统问题。为了成功填报,建议试试这7步...
  4. php公众号第三方登录,微信公众号开发小记——3.接入三方登录
  5. linux启动python项目_java项目部署Linux服务器几种启动方式总结经验
  6. php格式转换rar,如何在PHP中创建压缩的RAR文件?
  7. python中的is和==
  8. mybatis开发中遇到的小问题
  9. CentOS中的网络管理
  10. 说说IUnitOfWork~DbContext对象的创建应该向BLL层公开