Closed gautierdelorme closed 8 years ago
Hi @gautierdelorme Can you reproduce the issue in the sample project by any chance?
No I can't but let me explain you my situation : I use AMTagListView in a custom UITableViewCell and in other view in an other viewController and I feel the bug happen when I show the custom UITableViewCell and I go to the other viewController right after.
Here how I add tags in my custom UITableViewCell :
-(void) setPost:(SCCurablePost *)post {
_post = post;
if (post.tags) {
[self.tagListView removeAllTags];
[self.tagListView addTags:post.tags];
[self updateLength];
}
}
and in my other ViewController :
[self.dataSource loadKeywordsWithSuccess:^{
if (self.dataSource.keywords) {
[_keysView.keywordListView addTags:self.dataSource.keywords];
[_keysView.keywords addObjectsFromArray:self.dataSource.keywords];
}
[_keysView updateLength];
[self updateLengthKeywords];
}failure:^(NSError *error) {
}];
Do you have any idea of the problem ?
Hard to say without being able to debug the code. Try to call addTags:tags andRearrange:NO
, just to make sure that the issue is in the rearrange.
When I call addTags:tags andRearrange:NO
I got the error because of the call in : (void)layoutSubviews
and when I call addTags:tags andRearrange:YES
and comment the line like this :
- (void)layoutSubviews {
[super layoutSubviews];
//[self rearrangeTags];
}
I got the error because of the call in removeAllTags so I created :
- (void)removeAllTagsAndRearrange:(BOOL)rearrange{
for (AMTagView *tag in self.tags) {
[tag removeFromSuperview];
}
[self.tags removeAllObjects];
if (rearrange)
[self rearrangeTags];
}
But even if I use this function and then I call addTags:tags andRearrange:YES
I got the same error...
Can you reproduce your config in a separate project that I can debug?
Guess not. Closing this, feel free to reopen if you need to.
Hi ! I have an issue in rearrangeTags on this line :
[self addSubview:obj];
Sometimes I got this exception :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
But when I do this to debug :
the NSLog print the good tagText and I got the same error so I don't understand... Thanks for your help !