zoukankan      html  css  js  c++  java
  • swift 创建第一个UIAlertView 和UIActionSheet



    //创建 UIActionSheet

    //一定要指明类型。不编译不通过

    func ActionSheet(sender:UITapGestureRecognizer)
        {
            let actionSheet: UIActionSheet = UIActionSheet(title:"Are you sure?", delegate:self, cancelButtonTitle:"Cancel", destructiveButtonTitle:"Yes,I'm sure!");
            actionSheet.showInView(self.view)
            
        }

    //actionSheet delegate
        func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
            if buttonIndex == 0{
                println("点击位置为(buttonIndex)")
            }
        }

    //创建UIAlertView


    func firstSwift(sender:UIButton)
        {
           println("第一个button的点击事件")
           self.label1.text = "button点击了"
           var alert = UIAlertView(title: "⚠", message: "button被点击了", delegate: self, cancelButtonTitle: "知道了")
           alert.show()
        }

  • 相关阅读:
    C#语法糖
    C#十种语法糖
    委托
    C#迭代器
    C#事件
    C#事件
    c# event 事件浅析
    ASP.NET CORE 增删改查
    asp.net core 增删改查
    asp.net core 搭建MVC
  • 原文地址:https://www.cnblogs.com/llguanli/p/8409191.html
Copyright © 2011-2022 走看看