diff --git a/GMGridView/GMGridView.m b/GMGridView/GMGridView.m index c362c29..a7ae106 100644 --- a/GMGridView/GMGridView.m +++ b/GMGridView/GMGridView.m @@ -1626,12 +1626,6 @@ - (void)insertObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat { cell = [self newItemSubViewForPosition:index]; - for (int i = _numberTotalItems - 1; i >= index; i--) - { - UIView *oldView = [self cellForItemAtIndex:i]; - oldView.tag = oldView.tag + 1; - } - if (animation & GMGridViewItemAnimationFade) { cell.alpha = 0; [UIView beginAnimations:nil context:NULL]; @@ -1642,6 +1636,12 @@ - (void)insertObjectAtIndex:(NSInteger)index withAnimation:(GMGridViewItemAnimat } [self addSubview:cell]; } + + for (int i = _numberTotalItems - 1; i >= index; i--) + { + UIView *oldView = [self cellForItemAtIndex:i]; + oldView.tag = oldView.tag + 1; + } _numberTotalItems++; [self recomputeSizeAnimated:!(animation & GMGridViewItemAnimationNone)];