1

I want my UITextField doesn't show keyboard but the value still can be selected (for example, user wants to move cursor to any index in UITextField)

I have tried to do it this way:

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
  [self numberInput].delegate = self;
}

- (void)textFieldDidBeginEditing:(UITextField *)textField{
  [[self numberInput] resignFirstResponder];
}

but the result is, I can't select value from textField. Is there any workaround for this?

Rendy
  • 5,572
  • 15
  • 52
  • 95

1 Answers1

0

You can change the input of the textField.

If you pass an empty UIView, the keyboard will not appear and you should be able to select the text anyway. In swift 2.0:

textField.inputView = UIView()