2015-09-10 6 views
6

UITextfield内のデータをスクロールする必要があるため、スクロールで長い幅のテキストを見ることができます。uitextfield内のテキストをスクロールする方法iOS

+3

なぜあなたにスクロール機能を与える 'UITextView'を使わないのですか? – Kampai

+0

UITextViewではなく、UITextViewを使用する必要があります。なぜ、テキストフィールド内でスクロールしたいのですか?何か特別な理由? –

+0

1行のテキストを左右に移動して、テキスト全体を見ることができます。 – user1728987

答えて

-1

このようにすることができます。

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]; 
+4

textFieldのような名前をtextViewに与えるのは、実際には悪い練習です! –

-1

あなたはUITextViewを使用することができます:以下を試してみてください。

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]; 
関連する問題