UITextView

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
文字列追加
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSString *str = @"abc";
[_textView setText:[_textView.text stringByAppendingString:str]];
str = @"def";
[_textView setText:[_textView.text stringByAppendingString:str]];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
トップにスクロールする
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
[_textView setContentOffset:CGPointZero animated:NO];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ボトムにスクロールする
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
最終行にスクロールする
  //    _textView.scrollEnabled = NO; // 必要?
   [self scrollText];

- (void)scrollText
{
  NSRange range;
   range.location = [_textView.text length];
   _textView.selectedRange = range;
   _textView.scrollEnabled = YES;
  
   CGFloat scrollY = _textView.contentSize.height + _textView.font.pointSize - _textView.bounds.size.height;
   CGPoint scrollPoint;
  
   if (scrollY < 0) {
       scrollY = 0;
   }
   scrollPoint = CGPointMake(0.0, scrollY);
  
   [_textView setContentOffset:scrollPoint animated:YES];
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
デリゲートメソッド
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- (void)textViewDidBeginEditing:(UITextView *)textView // テキストビューの編集の開始時
- (void)textViewDidEndEditing:(UITextView *)textView    // テキストビューの編集の終了時
- (void)textViewDidChange:(UITextView *)textView    // テキストビューに変更が生じた時
- (void)textViewDidChangeSelection:(UITextView *)textView   // テキストビューの選択状態の変更時
最終更新:2015年10月30日 14:00