textView使用总结

1.处理textView的return事件

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    if (1 == range.length) {   //空格
        return YES;
    }
    if ([text isEqualToString:@"\n"]) { //return
        [textView resignFirstResponder];
        return NO;
    }
    return NO;
}

posted @ 2012-07-27 17:29  Lawerence  阅读(180)  评论(0编辑  收藏  举报