问下,如何接收点击TextField的消息?或者当我点击textfield时候弹出键盘的消息???键盘在输入时候的事件我如何响应啊?????????我会c++不会objective-c,求大神帮忙啊??????????????

解决方案 »

  1.   

    在TextField所在的UIViewController里实现UITextFieldDelegate协议- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;        // return NO to disallow editing.
    - (void)textFieldDidBeginEditing:(UITextField *)textField;           // became first responder
    - (BOOL)textFieldShouldEndEditing:(UITextField *)textField;          // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
    - (void)textFieldDidEndEditing:(UITextField *)textField;             // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;   // return NO to not change text- (BOOL)textFieldShouldClear:(UITextField *)textField;               // called when clear button pressed. return NO to ignore (no notifications)
    - (BOOL)textFieldShouldReturn:(UITextField *)textField; 
      

  2.   

    在Controller实现协议就好了