【发布时间】:2012-01-18 18:45:48
【问题描述】:
所以我有一个带有文本字段形式的 uiscrollview。我正在尝试向背景添加一个动作,以便当用户点击背景时,键盘会缩回。
我能够让 backgroundTap 收回键盘,但它禁用了我的 uibuttons:Detecting hits in UIScrollView while still letting it do it's thing
如第二个答案所述,我将此代码添加到 viewDidLoad:
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTap:)];
[scrollView addGestureRecognizer: singleTap];
backgroundTap 在哪里
- (IBAction)backgroundTap:(id)sender
这让我可以在 uiscrollview 上使用 backgroundTap 收回键盘,但它禁用了我的取消按钮,它关闭了表单的模式视图,以及发送 HTTP Post 的提交按钮。
任何想法为什么它会禁用 uibuttons?
【问题讨论】:
标签: uiscrollview uibutton