UITextField: Can not type text, but smileys, copy / paste, and the backspace is well


I think this is strange, I have made my own class that inherits from UIAlertView. In this class I add a UITableView as subview and the cells contains a UILabel and a UITextField.

the class implements: UITableViewDelegate, UITableViewDataSource and UITextFieldDelegate,

In the cellForRowAtIndexPath each cell.uiTxtField.delegate is set to self.

The following happens both in the simulator and on the real iPhone device:

  • When I set the pointer/finger in the UITextField the keyboard pops up and textFieldDidBeginEditing is triggered, that's fine and as expected.

  • When I leave the UITextField, textFieldDidEndEditing is triggered, that's also fine and as expected.

  • But when I start to type text, the cursor stops blinking but no text is typed to the UITextField.

  • I can copy and paste text by holding down the pointer/finger in a UITextField that contains text, select copy and then paste it in another UITextField (or the same).

  • The backspace works fine.

  • It also let's me type in symbols and smilies etc.

  • The only thing I can't type in is characters/letters and numbers

  • The return button doesn't trigger textFieldShouldReturn

Since textFieldDidBeginEditing and textFieldDidEndEditing is triggered I assume my delegate setup is fine, but I can't understand why I can't type text and why textFieldShouldReturn is not triggered.

This might be related.

Any help is appreciated.

have you put this in the "init" method of your custom class?

try putting a code like this in your implementation file...

@implementation CustomAlertClass <UITextFieldDelegate>

- (id)initWithFrame:(CGRect)frame
    self = [super initWithFrame:frame];
    if (self) {
    self.YourTextField.delegate = self;
return self;