1

I have a subclassed UIView, which is @IBInspectable and add a UIButton as a subview. In Interface Builder, I can of course only see the UIView but not the subview UIButton. How can I add an IBAction for the UIButton, or be able to define in Interface Builder, which method to call when tapped on this button?

Kaushik Makwana
  • 1,329
  • 2
  • 14
  • 24
Pauli
  • 343
  • 1
  • 4
  • 17
  • Do you want to do it via the Interface Builder only? Because you can use the `addTarget` method programmatically to specify which method to call when the button is tapped. – shriakhilc May 14 '19 at 05:48
  • @TheGamer007 Yes, i would like to add it via the Interface Builder, so that I could assign different methods to different instances – Pauli May 14 '19 at 05:52
  • Related: https://stackoverflow.com/questions/53887510/create-custom-action-in-a-class-for-use-in-interface-builder – Sweeper May 14 '19 at 06:08

0 Answers0