2012-02-02 12 views
7

मेरे पास UITextView है जो कीबोर्ड से इनपुट प्राप्त करता है। "ऑटो सक्षम रिटर्न कुंजी" चेकबॉक्स चेक किया गया है, इसलिए जब UITextView खाली है तो रिटर्न कुंजी अक्षम है।कीबोर्ड पर रिटर्न कुंजी मैन्युअल रूप से सक्षम या अक्षम कैसे कर सकता हूं?

मेरे पास कीबोर्ड के ऊपर एक इमोटिकॉन्स बार है जो UITextView पर इमोटिकॉन्स भी जोड़ सकता है, लेकिन यहां समस्या है; जब UITextView खाली है और मैं UITextView इस तरह के किसी भी इमोटिकॉन जोड़ें:

[inputTextView insertText:@"\ue40d"]; 

तो ReturnKey अभी भी अक्षम है, हालांकि UITextView का पाठ संपत्ति खाली नहीं है।

[inputTextView setEnablesReturnKeyAutomatically:NO]; 
कोई परिणाम नहीं के साथ

:

मैं किसी भी इमोटिकॉन डालने के बाद यह कोशिश की है। ऐसा लगता है कि कीबोर्ड की रिटर्न कुंजी को सक्षम/अक्षम करना केवल कुंजीपटल के माध्यम से अक्षर दर्ज करके ट्रिगर किया जाता है।

कोई विचार है कि रिटर्न कुंजी मैन्युअल रूप से सक्षम/अक्षम कैसे करें?

+0

यह उद्देश्य के अनुसार कार्य करता है इसे में? –

उत्तर

2

यह एक हैक का एक सा है, लेकिन आप के बजाय पेस्टबोर्ड के माध्यम से पाठ डालने की कोशिश कर सकते: यदि आप सामान्य पाठ लिखें

UIPasteboard* generalPasteboard = [UIPasteboard generalPasteboard]; 

// Save a copy of the system pasteboard's items 
// so we can restore them later. 
NSArray* items = [generalPasteboard.items copy]; 

// Set the contents of the system pasteboard 
// to the text we wish to insert. 
generalPasteboard.string = text; 

// Tell this responder to paste the contents of the 
// system pasteboard at the current cursor location. 
[textfield paste: nil]; 

// Restore the system pasteboard to its original items. 
generalPasteboard.items = items; 

// Free the items array we copied earlier. 
[items release]; 
-1

अचिह्नित "ऑटो सक्षम वापसी कुंजी"

+1

यह हर समय सक्षम बनाता है ... – GreenKiwi

संबंधित मुद्दे