UIButton
에 UILongPressGestureRecognizer
인스턴스를 만들고 연결하십시오.
-(IBAction)SelectImage:(id)sender
{
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressMethod:)];
[self.button addGestureRecognizer:longPress];
}
그런 제스처를 [``UILongPressGestureRecognizer (https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer?language=objc) 용
- (void)longPressMethod:(UILongPressGestureRecognizer*)gesture
{
if (gesture.state == UIGestureRecognizerStateEnded)
{
NSLog(@"Long Press");
//Do your code here what you want to perform
}
}
모습을 처리하는 방법을 만들 –