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

用rac_signalForSelector 代替textField:shouldChangeCharactersInRange:replacementString :时无法输入 #155

Open
lilong-git opened this issue Mar 23, 2019 · 0 comments

Comments

@lilong-git
Copy link

_textField = [UITextField new];
_textField.frame = CGRectMake(50, 50, 200, 30);
_textField.backgroundColor = [UIColor cyanColor];
_textField.delegate = self;
[self.view addSubview:_textField];

[[self rac_signalForSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:) fromProtocol:@protocol(UITextFieldDelegate)] subscribeNext:^(RACTuple *x) {
    NSLog(@"_____%@",x);
}];

output:
2019-03-23 17:49:59.611420+0800 LLKit[18454:188204] _____<RACTuple: 0x600000314290> (
"<UITextField: 0x7f8601032400; frame = (50 50; 200 30); text = ''; opaque = NO; gestureRecognizers = <NSArray: 0x600000f4e3a0>; layer = <CALayer: 0x600000144760>>",
"NSRange: {0, 0}",
S
)
2019-03-23 17:49:59.777225+0800 LLKit[18454:188204] _____<RACTuple: 0x60000030add0> (
"<UITextField: 0x7f8601032400; frame = (50 50; 200 30); text = ''; opaque = NO; gestureRecognizers = <NSArray: 0x600000f4e3a0>; layer = <CALayer: 0x600000144760>>",
"NSRange: {0, 0}",
S
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant