- (void)textViewDidChange:(UITextView *)textView {
NSInteger number = [textView.text length];
if (number > 128) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"字符個數不能大於128" delegate:self cancelButtonTitle:@"肯定" otherButtonTitles:nil];
[alert show];
textView.text = [textView.text substringToIndex:128];
number = 128;
[alert release];
}
self.statusLabel.text = [NSString stringWithFormat:@"%d/128",number];
} 函數