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 不可编辑)
在您的代码中使用覆盖 touchesBegan
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event { UITouch *touch = [[event allTouches] anyObject]; if ([touch view]==textviewtofocus) { // textviewtofocus get focus } else // textviewtofocus lost focus }