我有一个表单,假设通过点击向上显示并隐藏,但点击手势无法正常工作,当我点击其标签时,表单视图会显示。
- (void)hideForm
{
self.xButton.hidden = NO;
self.yButton.hidden = NO;
[self.testView addSubview:self.formLabel];
[UIView animateWithDuration:kDefaultAnimationDuration
animations:^{
CGRect frame = self.formView.frame;
frame.origin.y += self.formView.frame.size.height -Height;
self.formView.frame = frame;
self.formLabel.alpha = 1.0;
frame = self.Form.frame;
frame.origin.y = Height;
self.Form.frame = frame;
}
completion:^(BOOL finished) {
}];
}
和
- (void)showForm:(UITapGestureRecognizer *)gesture
{
self.xButton.hidden = YES;
self.yButton.hidden = YES;
[UIView animateWithDuration:kDefaultAnimationDuration
animations:^{
CGRect frame = self.formView.frame;
frame.origin.y -= self.formView.frame.size.height - Height;
self.formView.frame = frame;
self.formLabel.alpha = 0.0;
frame = self.Form.frame;
frame.origin.y = 0.0;
self.Form.frame = frame;
}
completion:^(BOOL finished) {
[self.formLabel removeFromSuperview];
}];
}
- (UILabel *)formLabel
{
formLabel.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showForm:)];
[formLabel addGestureRecognizer:tap];
[formLabel setBackgroundColor:[UIColor clearColor]];
}
要点击,有一个标签可以点击,但是当表单显示时,标签将消失,表单需要通过点击表单的背景图像来消失。
任何想法如何解决这个问题?
由于