I am building a venue layout app for the ipad that will use different classes of objects (tables /chairs/ stage segments etc) for the user to add to the floor plan and adjust.
In other apps I have used UIgestures for the panning and rotation of objects:
- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {
CGPoint translation = [recognizer translationInView:self.view];
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x, recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointMake(0, 0) inView:self.view];
}
- (IBAction)rotateMe:(UIRotationGestureRecognizer *)recognizer{
recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
recognizer.rotation = 0;
}
However the objects for this app will be smaller than normal fingers will allow for multiple touch gestures.
I would like to opt for a “Rotate” button within the view that when pressed and held will allow a single touch on anyobject to custom rotate it.
Or if anyone can guide me to a better option?
There’s a project on GitHub called KTOneFingerRotationGestureRecognizer that is a custom rotation gesture recognizer that uses a single finger to do rotations. You touch down on an object and spin it as if it had an axle in it’s center. It might work for you, depending on how small your shapes are. You might need to make your views a little larger the the images they contain (add some padding, in other words.)