Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想以编程方式关闭UITextView. 我知道如何防止它出现,但我也希望能够关闭一个打开的。
UITextView
每当您想关闭它时,只需删除UITextView的响应者。例如,您想在用户触摸弹出菜单之外时关闭它(顺便说一句,默认情况下已经发生了!)。为此,您可以执行以下操作:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ [yourTextView resignFirstResponder]; }