DixieFlatline
DixieFlatline

Reputation: 8035

How to pull a view from one corner of the app?

I would like to create view that could be pulled from one corner to take full screen (like the iphone status bar that can be pulled from top). Could you just give me an idea how to accomplish that.

Thanks

Upvotes: 0

Views: 48

Answers (1)

Ole Begemann
Ole Begemann

Reputation: 135558

  1. Put a small view into the corner of the screen that acts as your handle.
  2. Add a UIPanGestureRecognizer to that view.
  3. When the gesture recognizer's action method gets called, move the handle and the view you want to present according to the movement of the user's finger.
  4. When the gesture ends (because the user has lifted their finger off the screen), decide whether the movement was large enough to bring in the new view or not (e.g. if the user dragged the view over >30% of the screen, you move it in, otherwise you move it back out).
  5. Animate the view into its final position.

Upvotes: 1

Related Questions