Skip to content

bugs in deletion #62

@suyangdong

Description

@suyangdong

When delete a photo in the scrollview, and then scroll to the next one, you will find the photo is repeated in the next frame.
Reason:
The program thought the next frame is still valid so doesn't bother to reload:
if (NO == [currentPhotoView isKindOfClass:[KTPhotoView class]]) {
...
}

Solution:
Modify UnloadPhoto as follows

  • (void)unloadPhoto:(NSInteger)index removeOrReplace:(BOOL)remove;
    {
    if (index < 0 || index >= photoCount_) {
    return;
    }

    id currentPhotoView = [photoViews_ objectAtIndex:index];
    if ([currentPhotoView isKindOfClass:[KTPhotoView class]]) {
    [currentPhotoView removeFromSuperview];
    [photoViews_ replaceObjectAtIndex:index withObject:[NSNull null]];
    }

    if (remove) {
    [self unloadPhoto:index+1 removeOrReplace:FALSE];
    }
    }

The only case that removeOrReplace is true is when deletion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions