2015-09-10 6 views
6

के अंदर पाठ को स्क्रॉल करने के लिए कैसे करें मुझे यूआईटीएक्स्टफील्ड के अंदर डेटा स्क्रॉल करने की आवश्यकता है ताकि स्क्रॉलिंग द्वारा लंबी चौड़ाई का टेक्स्ट देखा जा सके। क्या कोई इसे हल करने के लिए मुझे जवाब दे सकता है।uitextfield आईओएस

+3

आप 'UITextView' का उपयोग क्यों नहीं करते हैं जो आपको स्क्रॉलिंग सुविधा देता है। – Kampai

+0

यू को UITextView का उपयोग करना है जिसके लिए UITextfield नहीं है। आप टेक्स्टफील्ड के भीतर स्क्रॉल क्यों चाहते हैं? कोई विशेष कारण? –

+0

मैं सिंगल लाइन टेक्स्ट को बाएं और दाएं स्थानांतरित करना चाहता हूं, ताकि पूरा टेक्स्ट देखा जा सके। – 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

टेक्स्टफिल्ड जैसे टेक्स्ट फ़ील्ड जैसे नाम देना वास्तव में एक बुरा अभ्यास है !!! –

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