zoukankan      html  css  js  c++  java
  • Swift

    1,下面创建一个操作表(或叫底部警告框)并弹出显示

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    class ViewController: UIViewController,UIActionSheetDelegate {
        override func viewDidLoad() {
            super.viewDidLoad()
            
            var actionSheet=UIActionSheet()
            //actionSheet.title = "请选择操作"
            actionSheet.addButtonWithTitle("取消")
            actionSheet.addButtonWithTitle("动作1")
            actionSheet.addButtonWithTitle("动作2")
            actionSheet.cancelButtonIndex=0
            actionSheet.delegate=self
            actionSheet.showInView(self.view);
        }
     
        func actionSheet(actionSheet: UIActionSheet!,clickedButtonAtIndex buttonIndex:Int){
                println("点击了:"+actionSheet.buttonTitleAtIndex(buttonIndex))
        }
    }

    2,在一般情况下,工具条,或标签条中显示的调用方式是不一样的

    1
    2
    3
    actionSheet.showInView(self.view);  //一般情况
    actionSheet.showFromToolbar(self.navigationController.toolbar)  //工具条的情况下
    actionSheet.showFromTabBar(self.tabBar)  //标签条的情况下
  • 相关阅读:
    nginx重启命令
    Java中Vector笔记
    JAVA中字符串比较equals()和equalsIgnoreCase()的区别
    HashMap和TreeMap的常用排序方法
    Logger用法
    HashMap和Hashtable的区别
    class.getDeclaredFields()与class.getFields()
    java中 文件压缩处理
    Java远程执行Shell命令
    python 学习笔记 redis操作
  • 原文地址:https://www.cnblogs.com/Free-Thinker/p/4838168.html
Copyright © 2011-2022 走看看