Closed akhatmullin closed 9 years ago
Yes, Andrey. AKTagCell contain this method, but we have class 'AKTagTextFieldCell' and his superclass is 'UICollectionViewCell', not 'AKTagCell' I can repeat this bug and crash with fast entering tags.
I think there is a bug with wrong determined AKTagCell var. It should not reference to a textFieldCell
In other words the variable must refer on either nil or a tagCell. But not a textFieldCell for sure.
"To be or not to be?" (c) :) But in line 127 in file AKTagInputView.m we get object 'lastTagCell' by method 'cellForItemAtIndexPath:indexPathForRow:inSection:' and this method returning to us object class 'AKTagTextFieldCell'
Yes, I think we should change the if
statement:
if (self.selectedTags.count > 1){
lastTagCell = (AKTagCell*)[self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:self.selectedTags.count-1 inSection:0]];
}
so that we never make our lastTagCell
to refer to the textfield cell
I think this is not solution. We always have cell with textfield for input (1, 5, 5000 items in array 'selectedTags')
In other way I see more dirthy solution - change base class for 'AKTagTextFieldCell' to 'AKTagCell'
I see no reason to inherit textField cell from TagCell. They are too different objects.
Oh nevermind my mistake about self.selectedTags.count
.
And at this point our ideas identical about base class for AKTagTextFieldCell
:)
Hmm! What you think about checking the class of lastTagCell
?
if ([lastTagCell isKindOfClass:NSClassFromString(@"AKTagCell")]) {
[lastTagCell resetReadyForDeleteStatus];
}
I'd prefer to fix a root of the problem. The bug appears because of fast tags entering. So we must check for the inconsistent state, that becomes possible in this particular tricky user behaviour. Checking the kindOfClass is another dirty workaround I my opinion. You can use it for some time, but I'm definitely going to fix the root of the problem.
I think the inconsistency becomes possible because of a time lag, that may exists before user tapped Return
and the selectedTags
gets new tag into (something about collection view animation, reloading and completion callbacks). Not sure. Need to check this.
check my comments in AKTagsListView
-> - (void)addNewItemWithString:(NSString *)string completion:(void(^)(void))compeltion
if you want some details
You a right! My solutions is not pretty. :) Hope I help you with updating your beautiful tool for input tags.
I see that more later. Thank you!
... fix