I set up using the Touch sample. Not sure if this is the right way.
All this is done in the view controller with both views (topView and bottomView).
in viewDidLoad I add all gesture recognizers to the top view -
tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureCaught)]; [tapGesture setDelegate:self]; [topView addGestureRecognizer:tapGesture]; [tapGesture release]; panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panBottomView)]; [panGestureRecognizer setMaximumNumberOfTouches:2]; [panGestureRecognizer setDelegate:self]; [topView addGestureRecognizer:panGestureRecognizer]; [panGestureRecognizer release]; pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scaleBottomView)]; [pinchGesture setDelegate:self]; [topView addGestureRecognizer:pinchGesture]; [pinchGesture release];
Gesture actions
- (void)panBottomView { UIView *piece = bottomView;
I have not fully tested all the code. Try it and see how it works.
source share