I have a UIView
as the main view and add a QLPreviewController
as the subview over that while previewing the document. I want to restrict the long press gesture so that no one can copy contents from the document. I have tried the following code:
Code Snippet :
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:nil];
longPress.allowableMovement=100;
longPress.minimumPressDuration=0.3;
longPress.delegate=self;
longPress.delaysTouchesBegan=YES;
longPress.delaysTouchesEnded=YES;
longPress.cancelsTouchesInView=YES;
[previewController.view addGestureRecognizer:longPress];
[self.view addSubview:previewController.view];
But no success. Can anyone tell me where am I going wrong and what could be done to disable the long press gesture ?
I have tried this as well :
NSArray *arr = previewController.view.gestureRecognizers;
for (int i = 0; i < arr.count; i++) {
if ([[arr objectAtIndex:i] isKindOfClass:[UILongPressGestureRecognizer class]]) {
[previewController.view removeGestureRecognizer:[arr objectAtIndex:i]];
}
}