Closed leoxpx closed 6 years ago
so just use view.endediting()
?
Please, give provide more details about this issue. How it's going locked? SOme screenshots or code or both of them.
@Maxatma provide the good quick fix for that, but actually, it could be nice, if it should work without the extra code. (for example, we can fire endEditing from the picker) 👍
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
......
[cell setupTitlte:_inputInfosModel.inputLabel inputText:showArr.firstObject inputPlaceholder:_inputInfosModel.inputTip inputAction:nil selectAction:^{
[self dismissKeyboard]; // dismiss keyboard ActionSheetStringPicker * picker = [[ActionSheetStringPicker alloc]initWithTitle:@"choose" rows:showArr initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) { ...... } cancelBlock:nil origin:self.view]; }];
- (void)dismissKeyboard { [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:UIEventTypeTouches]; // [self.view endEditing:YES]; // [cell.inputText resignFirstResponder]; // no effect all of them }
@leoxpx Please, format your code, it is impossible to read. To help you, @skywinder first need to read what problem you have.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell * cell = ......
[cell setupTitlte:@"title" inputText:@"" inputPlaceholder:@"please input" inputAction:nil selectAction:^{
[self dismissKeyboard]; // dismiss keyboard
ActionSheetStringPicker * picker = [[ActionSheetStringPicker alloc]initWithTitle:@"choose" rows:showArr initialSelection:0 doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
......
} cancelBlock:nil origin:self.view]; }];
}
-(void)dismissKeyboard {
[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:UIEventTypeTouches];
// [self.view endEditing:YES];
// [cell.inputText resignFirstResponder]; // no effect all of them
} `
@ UITableViewCell
- (void)setupTitlte:(NSString *)title inputText:(NSString *)input inputPlaceholder:(NSString *)placeholder inputAction:(InputAction)inputAction selectAction:(InputAction)selectAction {
if (selectAction) {
self.selectAction = selectAction;
[self.inputText addTarget:self action:@selector(selectedClick) forControlEvents:UIControlEventEditingDidBegin];
}
}
- (void)selectedClick {
self.selectAction();
}
@leoxpx Not sure, if I correctly understood ur code, but we only see how u initialize ur picker, nothing about how it appears.
Thanks, a lot for dive into and helping with this, @Maxatma 👍 Much appreciated!
@leoxpx please, show the code, that presents picker. (ie showPicker
method)
Feel free to reopen the issue, if you still need help. 👍
when i choose a textField then choose picker, both of them couldn't down ,the view is death.