开发者

iPhone UITextView which is disabled becomes first responder when re-enabled

I 开发者_JAVA技巧have an application which has some text views on one of the controllers. When the application is processing these text views are disabled and have their user interaction disabled.

The problem is that when the text views are re-enabled they respond to any touches made when they where disabled.

This is made even worse because they become the first responder but the code I have written for textViewDidBeginEditing is NOT run... this means that instead of having the done button on the top right of the Nav Bar instead it still presents the submit button instead.

I have tried automatically resigning first responder when they become active but this has no effect.

Does anyone know why these clicks while deactivated take effect when re-enabled and how to stop them. Bear in mind I have tried to resign first responder and disabled user interaction already.

Thanks Craig

EDIT:

I've just noticed that this problem is not caused by clicks while inactive, but because setting the UITextView to enabled causes it to display the keyboard.

This is a known defect since iPhone OS 2.1... Release note for 2.2


This is an bug known since iPhone OS 2.1. When you call UITextView.enabled = YES the keyboard appear, see the release note for OS 2.2 Release Note

The workaround is not to useUITextView.enabled at all, instead use [UITextView setUserInteractionEnabled:] when you want to enable or disable the UITextView.

Craig


UITextView does not have a property called enabled. You should use editable instead.


Did you try resigning first responder when text becomes inactive instead of when it becomes active?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜