1)TextView で ScrollView を有効にしたい。TextView の高さを大きくした場合。
2) Enter キーを押した後に全行を入力すると、入力した内容が表示されます。ただし、Enter キーを押した後に 2 文字または 3 文字を入力すると、入力内容が表示されません。Enter キーを押した後に表示されます。
-(void)viewDidLoad
{
UITextView *txtView=[[UITextView alloc]init];
txtView.frame = CGRectMake(60, 100, 350, 154);
txtView.backgroundColor=[UIColor whiteColor];
txtView.font=[UIFont fontWithName:Nil size:30];/*Font size*/
txtView.delegate=self;
txtView.scrollEnabled=YES;
[self.view addSubview:txtView];
}
-(void)textViewDidChange:(UITextView *)textView
{
if(textView.contentSize.height>textView.frame.size.height)
{
CGRect frame = txtView.frame;
frame.size.height = textView.contentSize.height+90;
textView.frame = frame;
textView.scrollEnabled=YES;
}
textView.scrollEnabled=YES;
}