zoukankan      html  css  js  c++  java
  • 【Swift】UIAlertController使用

    func clickButton1(){

    创建uialertcontroller

            var alertCtl : UIAlertController = UIAlertController(title: "Alert", message: "You clicked button1", preferredStyle: UIAlertControllerStyle.Alert)

    添加action到uialertcontroller,action是UIalertcontroller上的按钮操作,建议至少添加一个,如果不添加,alertcontroller就没有相应的按钮退出

            var alertAction : UIAlertAction = UIAlertAction(title: "Action", style: UIAlertActionStyle.Default, handler: { (param : UIAlertAction!) -> Void in

                println("I am alert action")

                var position = self.view.center.x

            })

            alertCtl.addAction(alertAction)

    显示alert controller

            self.presentViewController(alertCtl, animated: true, completion: nil)

            

            /*var alertView : UIAlertView = UIAlertView(frame: CGRect(origin: CGPoint(x: 50, y: 200), size: CGSize( 100, height: 40)))

            alertView.title = "Button1"

            alertView.message = "You clicked button1!"

            alertView.addButtonWithTitle("Confirm")

            alertView.delegate = self

            alertView.show()*/

        }

  • 相关阅读:
    分布式事务的MQ实现
    zipkin 介绍入门
    线程5问?
    微服务分布式系统架构,转载,备份
    微服务,分布式架构
    史上最全 40 道 Dubbo 面试题及答案,看完碾压面试官!
    Tomcat优化
    windows 下安装kafka
    经典台词
    分布式锁3种实现
  • 原文地址:https://www.cnblogs.com/AlwinXu/p/4457377.html
Copyright © 2011-2022 走看看