zoukankan      html  css  js  c++  java
  • Swift 2.0 UIAlertView 和 UIActionSheet 的使用

     在 IOS 9.0 之后, UIAlertView  是 给废弃了的,虽然你要使用的话,暂时还是可以的,但是在 9.0 之后,IOS 推荐大家使用的是  UIAlertController 这个控制器。下面是它的使用。

    //  在 IOS 9.0 之后, UIAlertView  是 给废弃了的,虽然你要使用的话,暂时还是可以的,但是在 9.0 之后,IOS 推荐大家使用的是  UIAlertController 这个控制器。下面是它的使用。
            let alview:UIAlertController = UIAlertController(title: "提示", message: "您点击了cell", preferredStyle: UIAlertControllerStyle.Alert)
            
            let action:UIAlertAction = UIAlertAction (title: "取消", style: UIAlertActionStyle.Cancel) { (action) -> Void in
            
                // 取消添加的点击事件
                print("好想你")
            }
            
            let actionOK:UIAlertAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default) { (actionOK) -> Void in
    
                // OK 的点击事件
                print("你还好吗")
            }
    
            // 这里就是添加一个 事件 上去的感觉, 只是这个  事件  是有类型 ,比如 删除, 取消
            alview .addAction(actionOK)
            alview .addAction(action)
            self .presentViewController(alview, animated: true) { () -> Void in
           
            }
    
  • 相关阅读:
    汉诺塔IX
    N!
    卡片游戏
    vuejs 2—bind
    vuejs 1—基础
    困难的串 Kryptn Factor Uva129
    JavaScript13—JSON
    JavaScript练习—二级菜单
    JavaScript12—tools.js
    JavaScript11—定时器
  • 原文地址:https://www.cnblogs.com/zhangxiaoxu/p/5295393.html
Copyright © 2011-2022 走看看