Ios development Note TextView
1. cannot scroll
self.scrollEnabled = NO;
2. Normal font
[UIFont systemFontOfSize:30.0f]
3. bold font
[UIFont boldSystemFontOfSize:30.0f]
4. Text Box offset
self.textContainerInset = UIEdgeInsetsMake(TEXTVIEW_TOP_INSET, TEXTVIEW_LEFT_INSET, TEXTVIEW_BOTTOM_INSET,TEXTVIEW_RIGHT_INSET);
5. Get the input status
[self becomeFirstResponder];
6. editable or not
[self setEditable:YES];
7. Restrict the input length
According to this idea, the length of the text to be generated = the length of the original text-the length of the selected text + the length of the input text. Considering the deletion, my code is as follows:-(BOOL) textView :( UITextView *) textView shouldChangeTextInRange :( nsange) range replacementText :( NSString *) text {if ([text is1_tostring: @ ""] & range. length> 0) {// The delete character must be safe return YES;} else {if (textView. text. length-range. length + text. length> MAX_INPUT_LENGTH) {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "beyond the maximum allowed length" message: nil delegate: self cancelButtonTitle: @ "OK" otherButtonTitles: nil]; [alert show]; return NO;} else {return YES ;}}}
8. You cannot select
[self setSelectable:YES];