zoukankan      html  css  js  c++  java
  • ios里的UIActionSheet的使用

    class ViewController: UIViewController,UIActionSheetDelegate{
        @IBOutlet weak var label1: UILabel!
    
        @IBAction func button1(sender: UIButton) {
            let actionSheet1 = UIActionSheet(title: nil, delegate: self, cancelButtonTitle: "取消分享", destructiveButtonTitle: "分享到新浪微博", otherButtonTitles: "分享到QQ空间")
            
            actionSheet1.showInView(self.view)
            
        }
        func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
            label1.text = actionSheet.buttonTitleAtIndex(buttonIndex)
        }
        
        @IBAction func button2(sender: UIButton) {
            
            let alertController = UIAlertController(title: "标题", message: "这个是UIAlertController的默认样式", preferredStyle: UIAlertControllerStyle.Alert)
            let cancelAction = UIAlertAction(title: "取消", style: .Cancel, handler: nil)
            let okAction = UIAlertAction(title: "好的", style: .Default, handler: nil)
            alertController.addAction(cancelAction)
            alertController.addAction(okAction)
            self.presentViewController(alertController, animated: true, completion: nil)
            }
        
        
        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
        }
    
        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
    }
  • 相关阅读:
    2月3日
    照片测试
    家属签证计时
    我来了
    090204 阴天
    重要提醒to 小爱
    小毛小毛
    C++Primer学习日程
    资料库字段存储文件记录的方式
    本日有点忙
  • 原文地址:https://www.cnblogs.com/adjk/p/5112280.html
Copyright © 2011-2022 走看看