I want to make a UITextField so开发者_如何转开发 that when I touch it, it runs a certain method, then if the conditions are correct (which are tested within that method), it will run its normal 'bring up the keyboard' method. How can I do this?
Set a delegate for your UITextField
textField.delegate = self;
Then within the delegate, implement:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
if (condition) {
return YES;
}
else {
return NO;
}
}
精彩评论