美文网首页
Swift操作表(UIActionSheet)的用法,也叫底部警

Swift操作表(UIActionSheet)的用法,也叫底部警

作者: MangoJ | 来源:发表于2016-06-29 19:38 被阅读172次
    import UIKit
    
    class ViewController: UIViewController        ,UITextFieldDelegate,UITextViewDelegate,UIActionSheet  Delegate,UIAlertViewDelegate{
    override func viewDidLoad() {
        super.viewDidLoad()
    
    
    let actionSheet = UIActionSheet()
        actionSheet.addButtonWithTitle("取消")
        actionSheet.addButtonWithTitle("ONE")
        actionSheet.addButtonWithTitle("TWO")
        actionSheet.cancelButtonIndex = 0
        actionSheet.delegate = self
        actionSheet.showInView(self.view)
    //        actionSheet.showInView(self.view);  //一般情况
    //        actionSheet.showFromToolbar(self.navigationController.toolbar)  //工具条的情况下
    //        actionSheet.showFromTabBar(self.tabBar)  //标签条的情况下
    
     } 
    
     func actionSheet(actionSheet:UIActionSheet,didDismissWithButtonIndex buttonIndex:Int){
        print("点击: "+actionSheet.buttonTitleAtIndex(buttonIndex)!)
    }
    
    }

    相关文章

      网友评论

          本文标题:Swift操作表(UIActionSheet)的用法,也叫底部警

          本文链接:https://www.haomeiwen.com/subject/zsexjttx.html