I've got a view within a navigation controller.
I am then adding a subview to this view and offsetting its origin height so that it covers only half the screen (with the other half overflowing off out the bottom of the screen). I want to be able to then drag this view upwards but it get stopped when it hits the bottom of the navigation bar.
I'm using a UIPanGestureRecognizer
to handle the dragging of the view and this works fine but it just won't seem to stop at the boundary.
This is the code I'm using:
bottomNavbarY = UIApplication.sharedApplication().statusBarFrame.size.height + self.navigationController!.navigationBar.frame.size.height
view.addSubview(pullover.view)
pullover.view.frame.origin.y = pulloverOffset
var animator = UIDynamicAnimator(referenceView: view)
var collision = UICollisionBehavior(items: [pullover.view])
collision.translatesReferenceBoundsIntoBoundary = true
collision.addBoundaryWithIdentifier("upper", fromPoint: CGPointMake(0, bottomNavbarY), toPoint: CGPointMake(UIScreen.mainScreen().bounds.size.width, bottomNavbarY))
animator.addBehavior(collision)
However, when I drag the covering view up it never interacts with any boundary, it just passes straight through. What am I doing wrong? Is it possible to use boundaries to stop views that are being dragged by the user in this way?