开发者

How to make a UITextField not respond?

开发者 https://www.devze.com 2023-02-28 17:15 出处:网络
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 \'brin

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;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消