How to scroll text inside uitextfield iOS

I need to scroll through the data inside a UITextfield so that when viewing it is possible to see text with a larger width.

Can someone answer me to solve this?

+6
source share
3 answers

You can do it this way.

  UITextView *textField = [[UITextView alloc]initWithFrame:CGRectMake(100, 100, 60, 50)]; textField.text = @"I need to scroll data inside UITextfield so that the text of longer width can be seen by scrolling.Can someone reply me to solve this."; textField.delegate = self; [self.view addSubview:textField]; 
0
source

You can use UITextView: Try below one.

 UITextView *textView=[[UITextView alloc] initWithFrame:CGRectMake(20, 40, 200, 70)]; textView.font=[UIFont systemFontOfSize:18.0]; textView.userInteractionEnabled=YES; textView.backgroundColor=[UIColor whiteColor]; textView.scrollEnabled=YES; textView.delegate = self; [self.view addSubview:textView]; 
0
source

You can check my demo: https://github.com/sunshuyao/ScrollableTextField I add a textField to the UIScrollView and change the contentSize when the text length changes, and scroll scrollView when the cursor position or selection range changes.

0
source

All Articles