Friday, December 9, 2016

Part 4 - UIView's User Interaction Enabled Property

When the user touches the screen, this is called a "user interaction". For a UIView, this property is defaulted to true. In code this property is userInteractionEnabled.

Observations

  • Unchecking this property for a button prevents that button from being touched.
  • If a UIView has User Interaction Enabled set to false, touches will still pass through to the views below it.
    Example:
         A - A UIView with User Interaction Enabled set to false.
         B - A UIButton.
         The button can still be clicked.
  • Animations set User Interaction Enabled to false during the animation.
  • Setting User Interaction Enabled to false on a parent UIView will disable user interaction on all UIViews within the parent (all subviews).
    Example:
         The button will not work.


(Xcode 8, Swift 3.0)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

SwiftUI Search & Filter with Combine - Part 3 (iOS, Xcode 13, SwiftUI, 2...

In part 3 of the Searchable video series, I show you how to use Combine in #SwiftUI for the search and filter logic connected to the searcha...