Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
The "Chaned" event is not raised if change text thru Text property
var textView = new UITextView();
textView.Changed += OnTextViewChanged;
text.Text = "";
but works properly if text is changed thru keyboard.
Please note: "Changed" event works fine in iOS5 on the same monotouch
Note: NSNotificationCenter.DefaultCenter.AddObserver(UITextView.TextDidChangeNotification, OnTextChanged, textView); works fine if change UITextView text thru Text property
I took the following Objective-C article on UITextView (http://mobile.tutsplus.com/tutorials/iphone/ios-sdk_uitextview_uitextviewdelegate_2/) and modified it so that you can press a button to set the TextView text and hooked up a AddObserver method.
On both iOS 5 and iOS 6 in Obj-C, the Changed event only fires when using the keyboard and not through setting the text programmatically, the project example can be found here: https://www.dropbox.com/s/1zvb8jrle7eocqi/TextViewObjC.zip
So whilst I can reproduce the issue on iOS 6, it looks as this is the correct behaviour and the AddObserver method is incorrect for both iOS 5 and iOS 6 with MonoTouch and the Changed event is causing the incorrect behaviour for just iOS 5.
Any thoughts Sebastien?
> Please note: "Changed" event works fine in iOS5 on the same monotouch
Sergey, please include the version numbers of the product you're using (it's not 6.1 since this version is not yet released).
You can get them from "MonoDevelop" menu, "About MonoDevelop" item, "Version Info" tab and copy/paste the version informations (at least down to the "Loaded assemblies" section).
The event should NOT occur if the text is changed from some code. From Apple documentation :
> The text view calls this method in response to user-initiated changes to the text.
> This method is not called in response to programmatically initiated changes.
OTOH Apple documentation for UITextFieldTextDidChangeNotification  does not make such claims:
> Notifies observers that the text in a text field changed.
> The affected text field is stored in the object parameter of the notification.
There's no "custom" code inside the bindings for this type/event - so MonoTouch should behave identically to iOS/ObjC in both cases (delegate/event and observer). I'll try this on an iOS 5 device (with and without MonoTouch).
Chris: please always attach your test cases to the bug report (useful for regression tracking in the future).
> On both iOS 5 and iOS 6 in Obj-C, the Changed event only fires when using the
> keyboard and not through setting the text programmatically
Chris, that's not what I see (using your ObjC sample). On iOS 5.1 I get:
2012-11-05 09:53:35.636 TextViewARC[10079:707] Button Pressed!
2012-11-05 09:53:35.649 TextViewARC[10079:707] textViewDidChange:
2012-11-05 09:53:35.653 TextViewARC[10079:707] Any method called
if I click the button *when* the keyboard is visible. If the keyboard is *not* visible then I only get:
2012-11-05 09:54:01.396 TextViewARC[10079:707] Button Pressed!
On iOS6, with keyboard visible I get:
2012-11-05 10:00:06.504 TextViewARC[604:907] Button Pressed!
2012-11-05 10:00:06.514 TextViewARC[604:907] Any method called
and without the keyboard:
2012-11-05 10:00:42.168 TextViewARC[604:907] Button Pressed!
So yes there's a "bug/feature" here, but it's in iOS 5 (fixed) or 6 (new) - depending on how Apple interpret the "right" behaviour. You might want to fill a bug report on Apple's radar.
Sorry, my fault. Monotouch version is 6.0.4