在ios6 ipad3上不会调用UITextFieldTextDidChangeNotification [英] UITextFieldTextDidChangeNotification doesn't get called on ios6 ipad3

查看:144
本文介绍了在ios6 ipad3上不会调用UITextFieldTextDidChangeNotification的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具有以下内容:

// watch the fields
[[NSNotificationCenter defaultCenter]  addObserver:self
                                          selector:@selector(handleTextChange:)
                                              name:UITextFieldTextDidChangeNotification
                                            object:textField1];

然后:

-(void) handleTextChange:(NSNotification *)notification {
  ...
}

-handleTextChange:中有一个断点,但不会被解雇。
textField在Interface Builder中连接。

Have a breakpoint in -handleTextChange:, but doesn't get fired. textField is connected in the Interface Builder.

适用于iOS5 iPhone / iPad模拟器,适用于iOS5.1 iPad2,但不适用于iOS6 iPad3。

Works on iOS6 iPhone/iPad simulator, on iOS5.1 iPad2, but not on iOS6 iPad3.

推荐答案

所以我弄清楚了。 IOS6 SDK中的变化是,如果以编程方式更改文本字段的文本,则不会发送通知。我在所有这些视图上都有一个自定义键盘。当我点击一个键时,它会通过添加我键入的内容来更改文本字段文本值。在ios 5中,它会发送通知textdidchange,但不会在ios6中发送。

so I figured it out. What changed in IOS6 SDK is that if you change the text of textfield programmatically, it doesn't send a notification. I have a custom keyboard on all of those views. when I tap on a key, it changes the text field text value by adding whatever I typed in. In ios 5 it would send a notification "textdidchange", but not in ios6.

这篇关于在ios6 ipad3上不会调用UITextFieldTextDidChangeNotification的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆