textField becomeFirstResponder failed
MrBoog opened this issue · 1 comments
MrBoog commented
I found that when current viewController show up again , the textField can't become first responder if return no
in this method
- (BOOL)tokenFieldShouldEndEditing:(ZFTokenField *)textField
{
return NO;
}
MrBoog commented
finally , I changed below method, fixed this problem . I won't remove textField .
- (void)reloadFieldData
{
for (UIView *view in self.tokenViews) {
if ([view isKindOfClass:[ZFTokenTextField class]]) {
continue;
}
[view removeFromSuperview];
}
self.tokenViews = [NSMutableArray array];
...
if ( ![self.tokenViews containsObject:self.textField] ) {
[self.tokenViews addObject:self.textField];
}
if ( ![self.textField isDescendantOfView:self] ) {
[self addSubview:self.textField];
}else{
[self bringSubviewToFront:self.textField];
}