You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug when deleting non-last photo. Another last photo appears beyond the last page of the scrollView_, though you cannot scroll to it. And sometimes next photo appear twice after delete.
Here are my fixes. (2 places, marked with // *** hlung: BUG FIX: )
Bug when deleting non-last photo. Another last photo appears beyond the last page of the scrollView_, though you cannot scroll to it. And sometimes next photo appear twice after delete.
Here are my fixes. (2 places, marked with // *** hlung: BUG FIX: )
(void)setCurrentIndex:(NSInteger)newIndex
{
currentIndex_ = newIndex;
// *** hlung: BUG FIX: after delete, next photo appear twice, unload the second one
[self unloadPhoto:currentIndex_ + 1];
// ***
[self loadPhoto:currentIndex_];
[self loadPhoto:currentIndex_ + 1];
[self loadPhoto:currentIndex_ - 1];
[self unloadPhoto:currentIndex_ + 2];
[self unloadPhoto:currentIndex_ - 2];
[self setTitleWithCurrentPhotoIndex];
[self toggleNavButtons];
}
(void)deleteCurrentPhoto
{
if (dataSource_) {
// TODO: Animate the deletion of the current photo.
NSInteger photoIndexToDelete = currentIndex_;
[self unloadPhoto:photoIndexToDelete];
// *** hlung: BUG FIX: remove the last photoView_ before decrementing photoCount_
if (photoCount_-1 > 0) [self unloadPhoto:photoCount_-1];
// ***
[dataSource_ deleteImageAtIndex:photoIndexToDelete];
photoCount_ -= 1;
if (photoCount_ == 0) {
[self showChrome];
[[self navigationController] popViewControllerAnimated:YES];
} else {
NSInteger nextIndex = photoIndexToDelete;
if (nextIndex == photoCount_) {
nextIndex -= 1;
}
[self setCurrentIndex:nextIndex];
[self setScrollViewContentSize];
}
}
}
The text was updated successfully, but these errors were encountered: