2012-02-02 14 views
7

Klavyeden girdi alan bir UITextView sahibim. "Dönüş Tuşunu Otomatik Etkinleştir" onay kutusu işaretlidir, bu nedenle UITextView boş olduğunda Dönüş tuşu devre dışıdır.Klavyede Geri Dönüş Tuşunu el ile nasıl etkinleştirebilir veya devre dışı bırakabilirim?

Klavyenin üzerinde, aynı zamanda UITextView ifadelerini ekleyebileceğiniz bir İfadeler çubuğum var, ancak işte sorun; UITextView boş ve böyle UITextView bir ifade eklemek zaman:

[inputTextView insertText:@"\ue40d"]; 

sonra ReturnKey hala devre dışı, UITextView text özelliği boş olmasa da.

Ben Bir ifade taktıktan sonra bu denedim: hayır sonuçlarla

[inputTextView setEnablesReturnKeyAutomatically:NO]; 

. Klavyenin Dönüş Tuşunu etkinleştirmek/devre dışı bırakmak sadece klavyeden karakterleri girerek tetiklenir.

Herhangi bir fikir, dönüş tuşunu manuel olarak nasıl etkinleştirir/devre dışı bırakır?

Bir hack biraz, ama bunun yerine mukavva aracılığıyla metin ekleme deneyebilirsiniz
+0

amaçlanan şekilde çalışıyor mu bunun içine? –

cevap

2

: Normal metin yazarsanız

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

işaretini "Otomatik Geri Dönüş Anahtarı etkinleştir"

+1

Bu her zaman etkin hale getirir ... – GreenKiwi

İlgili konular