|
|
@@ -17,6 +17,11 @@
|
|
|
if (self) {
|
|
|
[self becomeFirstResponder];
|
|
|
self.userInteractionEnabled=true;
|
|
|
+
|
|
|
+
|
|
|
+ UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
|
|
|
+ longPress.minimumPressDuration = 0.8; //定义按的时间
|
|
|
+ [self addGestureRecognizer:longPress];
|
|
|
// self.layer.borderColor = [UIColor darkGrayColor].CGColor;
|
|
|
// self.layer.borderWidth = 1.0;
|
|
|
}
|
|
|
@@ -29,6 +34,10 @@
|
|
|
self.userInteractionEnabled=true;
|
|
|
self.layer.borderColor = [UIColor darkGrayColor].CGColor;
|
|
|
self.layer.borderWidth = 1.0;
|
|
|
+
|
|
|
+ UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
|
|
|
+ longPress.minimumPressDuration = 0.8; //定义按的时间
|
|
|
+ [self addGestureRecognizer:longPress];
|
|
|
// Initialization code
|
|
|
}
|
|
|
/*
|
|
|
@@ -39,7 +48,22 @@
|
|
|
}
|
|
|
*/
|
|
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
|
|
+
|
|
|
+ if(delegate)
|
|
|
[delegate TouchImageViewOnTouche:self];
|
|
|
|
|
|
}
|
|
|
+-(void)longPress:(UILongPressGestureRecognizer*)gestureRecognizer{
|
|
|
+ if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
|
|
|
+
|
|
|
+ if(delegate)
|
|
|
+ [delegate TouchImageViewOnLongPress:self];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+//- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(nullable UIPressesEvent *)event
|
|
|
+//{
|
|
|
+// // event
|
|
|
+//}
|
|
|
@end
|