ios UIAlertActionStyle样式

typedefNS_ENUM(NSInteger, UIAlertActionStyle) {

    UIAlertActionStyleDefault =0,  // 默认样式

    UIAlertActionStyleCancel,       // 取消样式

    UIAlertActionStyleDestructive   // 点击按钮为红色

} NS_ENUM_AVAILABLE_IOS(8_0);


// 暂时没有发现 UIAlertActionStyleDefault 和 UIAlertActionStyleCancel 有什么区别

(2017-3-20)更新

今天看了下,cancel风格的话,不管你add到alertController上的顺序,在只有两个按钮的时候,都会按苹果的默认风格把取消按钮放在左边。(在有三个及其以上的时候会排在最后,这个你也可以自己试一下)

// 后面发现了,UIAlertActionStyleCancel 也就是取消样式的 UIAlertAction 在同一个UIAlertController中最多只能添加一个,多了就会崩溃。 将会报错:

'UIAlertController can only have one action with a style of UIAlertActionStyleCancel'

// (UIAction为两个时)取消样式的action是会加在左边的;(UIAction为多个时)在最下面

猜你喜欢

转载自blog.csdn.net/iamonmyownway/article/details/53893068