Reputation: 1475
I want to know whether a specific portion of a UI view can be made hidden.I have a view that is movable.The problem is that when I move the view down the view is visible below safe area.I want to hide the portions of the view that are below safe area.
Upvotes: 0
Views: 84
Reputation: 19737
If you constrain the enclosing view, lets call it simply view
, of that movableView
to the safeArea
, the easiest way would be to simple set:
view.clipsToBounds = true
This will prevent drawing any of the view
contents outside of its bounds. So if movableView
is its subview somewhere in the hierarchy, and its part moves out of the bounds (i.e. below the safeArea
), the part outside will be clipped and not rendered.
If not don't have such a view yet, adding a transparent view (backgroundColor = UIColor.clear
) that would be constrained as such with its clipsToBounds
set to true
would solve it for your.
Upvotes: 4