UIActionSheet

introduced=2.0, deprecated=8.3 早已废弃 还是拥抱 UIAlertController 吧

创建UIActionSheet

let actionSheel = UIActionSheet()
actionSheel.addButtonWithTitle("取消")
actionSheel.addButtonWithTitle("选项一")
actionSheel.addButtonWithTitle("选项二")
actionSheel.cancelButtonIndex = 0
actionSheel.delegate = self
actionSheel.showInView(self.view)

实现代理 先遵守协议 UIActionSheetDelegate

func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
        print(actionSheet.buttonTitleAtIndex(buttonIndex)!)
        if buttonIndex == actionSheet.cancelButtonIndex{
            print("取消了!")
        }else{
            print("都说了已经废弃了!!!")
        }
    }

  

来源: http://www.cnblogs.com/spaceID/p/4977054.html

posted @ 2015-11-19 11:21  寻找小猪  阅读(128)  评论(0编辑  收藏  举报