Pbk Pbk - 6 months ago 3x
Swift Question

Create an invisible view that is interactable in swift

For prototyping I am looking to create a invisible interaction area.

  • If I set the alpha to 0, you can't interact withit.

  • If you set it to
    hidden, it also does not receive gesture events.


Why do you want to use a View for this, Instead you could just use a UIButton and set frame to your current view's frame & set its background color to clearColor like below,

self.invisibleButton.backgroundColor = [UIColor clearColor];

This will do the same action & reduce little works like adding Tap gesture and setting some properties for the view if you go with View.