Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textField不走代理 #10

Closed
Gerhard94 opened this issue Feb 20, 2019 · 8 comments
Closed

textField不走代理 #10

Gerhard94 opened this issue Feb 20, 2019 · 8 comments

Comments

@Gerhard94
Copy link

textfield放在uitableViewCell上面 不用这个键盘的话会走textField的代理方法,如果用了就不走了

@yzhtracy
Copy link
Member

如果是使用的UItextField,因为用的非系统键盘 ,所以不会走UItextfield的代理。可以通过kvo来监听它的text值。

@Gerhard94
Copy link
Author

如果是使用的UItextField,因为用的非系统键盘 ,所以不会走UItextfield的代理。可以通过kvo来监听它的text值。

尝试过 没有调起kvo的方法

@noveleven
Copy link

@yzhtracy text可以kvo,但是 textFieldShouldReturn: 也没见调用啊

@noveleven
Copy link

noveleven commented Jun 17, 2019

文档不是说直接当做系统UItextfield使用即可么?!

@Tian-WJ
Copy link

Tian-WJ commented Jul 9, 2020

同问:textfield放在UICollectionViewCell上面,不用这个键盘的话会走textField的代理方法,如果用了就不走了,textFieldShouldReturn也不见调起

@Free-am
Copy link

Free-am commented Nov 21, 2020

虽然我在使用时解决了这个问题,但还是希望作者维护的时候能把这个功能完善下。支持开源!加油

@Free-am
Copy link

Free-am commented Nov 21, 2020

虽然我在使用时解决了这个问题,但还是希望作者维护的时候能把这个功能完善下。支持开源!加油

在UITableViewCell或者UICollectionViewCell里面,添加系统键盘弹出/收起观察者:

[[NSNotificationCenter defaultCenter] addObserver:self
                                   selector:@selector(keyboardDidShow:)
                                      name: UIKeyboardDidShowNotification
                                     object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
                                   selector:@selector(keyboardDidHide:)
                                      name: UIKeyboardDidHideNotification
                                     object:nil];

///实现观察方法

  • (void)keyboardDidShow:(NSNotification *)notif {
    NSLog(@"键盘打开");
    }

  • (void)keyboardDidHide:(NSNotification *)notif {
    NSLog(@"键盘关闭");
    ///在这里拿到textField的值进行显示或回传Controller,因为键盘收起其实就是确定和完成都包含的动作,取值时机相同。
    }

@yzhtracy
Copy link
Member

yzhtracy commented Dec 5, 2020

在1.0.7版本,已解决。新增系统输入框车牌键盘的一些事件监听。

@yzhtracy yzhtracy closed this as completed Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants