In my iPad app, I want the users to be able to resize a UIView by dragging the view from its edges. I’ll be using iOS 5 SDK, so what’s the cleanest approach to do this? Are there any alternatives to achieving this without dealing with touchesBegan, touchesMoved,… etc?
In my iPad app, I want the users to be able to resize a
Share
I’m guessing your UI involves some kind of handles on the sides of the view, and attaching a simple
UIPanGestureRecognizerto those handle controls makes the whole problem pretty easy.In the action method from the gesture recognizer, just get the
-translationInView:relative to the view you’re resizing, save off the original frame when the gesture recognizer’s state isUIGestureRecognizerStateBegan, and adjust the view’s frame continually while the state isUIGestureRecognizerStateChanged.