0

I have to implement a manufacturer keyboard test app of iOS on iPad.

I am surveying on this topic right now.

According to this article

[_myUITextField becomeFirstResponder];
[_myUITextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventAllEvents];
}

-(IBAction)textFieldDidChange:(id)sender{
    UITextField *_field = (UITextField *)sender;
    NSLog(@"%@",[_field text]);
}

With these code I can detect the letter(like 1,2,3,a,b,c...) I pressed in my app, but not all key pressed (like fn, ctl, cmd ...etc?)

Anyone know how to achieve this...thanks^^

Community
  • 1
  • 1
Gray lin
  • 33
  • 5

1 Answers1

0

Try Notification center instead.

 NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];

UITextField :

[notificationCenter addObserver:self
                   selector:@selector (textFieldText:)
                       name:UITextFieldTextDidChangeNotification
                     object:yourtextfield];
Snowmanzzz
  • 240
  • 5
  • 15
  • Hi man, thanks first, but the result is the same as previous method, it can't detect any key as well. – Gray lin Dec 22 '13 at 08:25