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.
我想制作一个 UITextField ,以便当我触摸它时,它会运行某个方法,然后如果条件正确(在该方法中测试),它将运行其正常的“启动键盘”方法。我怎样才能做到这一点?
为您的 UITextField 设置委托
textField.delegate = self;
然后在委托中,实现:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { if (condition) { return YES; } else { return NO; } }