UIButton return(textField textView)

首先设置TextField 或 TextView的 delegate
/////UITextView
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    if ([text isEqualToString:@"\n"]) {
        
        NSLog("点击return");
        return NO;
    }
    return YES;
}
/////UITextField
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    NSLog("点击return");
    return YES;
}


posted @ 2013-06-18 21:38  爱生活,爱编程  阅读(184)  评论(0编辑  收藏  举报