How to connect multiple buttons in a storyboard to a single action?

后端 未结 7 1088
梦谈多话
梦谈多话 2020-12-03 10:16

I\'m currently using Xcode 4.6 and I\'m simply wondering how to select multiple buttons across different UIViews, but under a single view controller. CMD clicking doesn\'t s

7条回答
  •  忘掉有多难
    2020-12-03 11:00

    Swift 3.0 Xcode 8.0+

    Connect all buttons to below method signature. Make sure argument sender is of type UIButton (Or subclass of UIButton) in-order to connect rest of the buttons from storyboard.

    @IBAction func dialconfigTapped(_ sender: UIButton) {}
    

    Use sender.tag to identify the tapped button.

提交回复
热议问题