Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
One problem with the simple approach of the earlier recipes in this chapter is that it’s entirely possible to drag a view offscreen to the point where the user cannot see or easily recover it. Those recipes uses unconstrained movement. There is no check to test whether the object remains in view and is touchable. Recipe 8-4 fixes this problem by constraining a view’s movement to within its parent.
It achieves this by limiting movement in each direction, splitting its checks into separate x and y constraints. This two-check approach allows the view to continue to move even when one direction has passed its maximum. If the view has hit the rightmost edge of its parent, for example, it can still move up and down.