views:

236

answers:

2

Hi,

I 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

A: 

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

DenNukem
Yes That Didn't Work
Craig Warren
+1  A: 

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

Craig Warren
I'm having a similar problem with a UITextView and the Editable flag. I suspect it's a related issue. I also suspect that this issue was cleared up in 4.0 or earlier, since I only have this problem when compiling for the iPad which still runs on 3.2
Ash