<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## UIButton 簡單的交互控件 **UIButton 控件**是最基礎的顯示控件。故名思意,UIButton 控件 是一個按鈕,提供給用戶讓用戶與我們設計的App進行交互。 其中給 button 添加事件的方法是 `addTarget`,如下文例舉中的 `button.addTarget(self, action: #selector(self.click), for: UIControlEvents.touchUpInside)` ``` override func viewDidLoad() { super.viewDidLoad() // 創建一個 button // let button: UIButton = UIButton(frame: CGRect( ) // 創建并設置 button 類型 let button: UIButton = UIButton(type: UIButtonType.system) // 自定義類型 contactAdd、infoDark、infoLight、detailDisclosure、system、custom // 設置 button 的位置 button.frame = CGRect(x: 100, y: 100, width: 100, height: 100) // button 顏色 button.backgroundColor = UIColor.green // button 添加事件 - 用于用戶交互 button.addTarget(self, action: #selector(self.click), for: UIControlEvents.touchUpInside) // button 標題 button.setTitle("按鈕", for: UIControlState.normal) // 設置 button 內容區域的偏移量 button.contentEdgeInsets = UIEdgeInsetsMake(-10, -10, 0, 0) // 設置按鈕圖片 // button.setBackgroundImage(UIImage(named:"0.png"), for: UIControlState.normal) // 設置背景圖片 button.setImage(UIImage(named:"0.png"), for: UIControlState.normal) // 設置圖片 // 開啟點擊效果 button.showsTouchWhenHighlighted = true // 設置高亮狀態按鈕標題 button.setTitle("新標題", for: UIControlState.highlighted) self.view.addSubview(button) } // 點擊后的處理函數 func click (button: UIButton){ print("按鈕被點擊!") let redPart: CGFloat = CGFloat(arc4random()%255) / 255 let greenPart: CGFloat = CGFloat(arc4random()%255) / 255 let bluePart: CGFloat = CGFloat(arc4random()%255) / 255 // 隨機 button 背景色 button.backgroundColor = UIColor(red: redPart, green: greenPart, blue: bluePart, alpha: 1.0) } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看