UIView alpha 0 but still receive touch events?

Tyler

I am trying to hide a uiview but still have it receive touch events. I am setting the alpha to 0 like so:

mainView.alpha = 0.0

also I've tried setting this to true but it doesn't do anything

mainView.userInteractionEnabled = true

Trouble is it no longer receives touch events when I do this. How can I enable it to receive touch events but be effectively hidden?

Daniel Storm

Set your UIView's backgroundColor to UIColor.clear.

mainView.backgroundColor = .clear

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to receive touch events from a CollectionView embedded inside a UiView embedded inside a UIScrollView

From Dev

Capturing and recording touch events on UIView

From Dev

duplicate/mirror touch events from uiview to uiscrollview

From Dev

How to prevent UIView passing touch events to UIView's superview?

From Dev

Is there a way to receive sub-precision touch events on iOS?

From Dev

How to let two overlapping views to receive the user touch events ios

From Dev

Can't receive touch events from UIButtons placed ontop of GMSMapView

From Dev

How to pass clicks and touch events through a region in a UIView?

From Dev

iOS: Why does hidden button still receive tap events?

From Dev

How can I make touch events pass through a UIView (similar to pointer-events:none in CSS)?

From Dev

iOS `UIView` stops responding to gesture recognizer when its alpha is 0?

From Dev

How to Enable Touch Events For a MapView underneath a UIView (iOS8/Swift)

From Dev

How to Enable Touch Events For a MapView underneath a UIView (iOS8/Swift)

From Dev

Receive touch event for subview

From Java

UIView touch event in controller

From Dev

No touch event on resized UIView

From Dev

Add touch in UIView - Xamarin

From Dev

UIView: Performance/memory difference between alpha:0, hidden:YES, removeViewFromSuperview and frame.origin.y = -100000;

From Dev

touch events firing twice

From Dev

SKSpriteNode not detecting touch events

From Dev

Safari not firing touch events

From Dev

Overlapping Fragments and Touch Events

From Dev

Switch to touch events with SnapSvg

From Dev

Processing Touch and Gesture Events

From Dev

Polymer project, touch events

From Dev

Click events in Sencha touch

From Dev

Enable Touch Events Chrome

From Dev

Touch events not working EaselJS

From Dev

jQuery touch events

Related Related

  1. 1

    How to receive touch events from a CollectionView embedded inside a UiView embedded inside a UIScrollView

  2. 2

    Capturing and recording touch events on UIView

  3. 3

    duplicate/mirror touch events from uiview to uiscrollview

  4. 4

    How to prevent UIView passing touch events to UIView's superview?

  5. 5

    Is there a way to receive sub-precision touch events on iOS?

  6. 6

    How to let two overlapping views to receive the user touch events ios

  7. 7

    Can't receive touch events from UIButtons placed ontop of GMSMapView

  8. 8

    How to pass clicks and touch events through a region in a UIView?

  9. 9

    iOS: Why does hidden button still receive tap events?

  10. 10

    How can I make touch events pass through a UIView (similar to pointer-events:none in CSS)?

  11. 11

    iOS `UIView` stops responding to gesture recognizer when its alpha is 0?

  12. 12

    How to Enable Touch Events For a MapView underneath a UIView (iOS8/Swift)

  13. 13

    How to Enable Touch Events For a MapView underneath a UIView (iOS8/Swift)

  14. 14

    Receive touch event for subview

  15. 15

    UIView touch event in controller

  16. 16

    No touch event on resized UIView

  17. 17

    Add touch in UIView - Xamarin

  18. 18

    UIView: Performance/memory difference between alpha:0, hidden:YES, removeViewFromSuperview and frame.origin.y = -100000;

  19. 19

    touch events firing twice

  20. 20

    SKSpriteNode not detecting touch events

  21. 21

    Safari not firing touch events

  22. 22

    Overlapping Fragments and Touch Events

  23. 23

    Switch to touch events with SnapSvg

  24. 24

    Processing Touch and Gesture Events

  25. 25

    Polymer project, touch events

  26. 26

    Click events in Sencha touch

  27. 27

    Enable Touch Events Chrome

  28. 28

    Touch events not working EaselJS

  29. 29

    jQuery touch events

HotTag

Archive