Prevent editing of text in UITextField and hide cursor/caret/magnifying glass while using an inputView

后端 未结 6 1637
北荒
北荒 2021-02-13 01:40

How do I prevent the editing of text in a UITextField along with hiding the cursor/caret/magnifying glass, but still present the keyboard, as I am using an in

6条回答
  •  温柔的废话
    2021-02-13 02:26

    To disable any interaction with textfield except for making it a first responder you can just place a UIButton of the same size right over the textfield. Code for button tap event could be something like this:

    - (IBAction)btnEditPhoneTapped:(id)sender
    {
        if (self.tfClientPhoneNo.isFirstResponder == NO) [self.tfClientPhoneNo becomeFirstResponder];
    }
    

提交回复
热议问题