如果在矩形区域内(touchUpInside)手指被抬起,我想触发一个segue。不知道怎么做。任何帮助都会有很大的帮助。
答案 0 :(得分:1)
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
CGRect targetRect = CGRectZero; // replace this with the rect the user has to touch to trigger the segue
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
if (CGRectContainsPoint(targetRect, touchLocation)) {
[self performSegueWithIdentifier:@"SEGUE_IDENTIFIER" sender:self];
}
}