Giter Site home page Giter Site logo

hpreordertableview's People

Contributors

hpique avatar mradamfrancis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hpreordertableview's Issues

cellForRowAtIndexPath custom cell with Images issue

I am running into an issue in the cellForRowAtIndexPath while dragging the row around eventually it crashes on the line below. Any thoughts?

Note: Since images are stored as external files in Core Data sometimes they take a few seconds to load. In order not to bug down the system I am using the dispatch_async. If I do not use the dispatch_async it does not crash

Crashes

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        ....
        cell.imageViewPhoto.image = nil;
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
            NSArray *listImagesArray = list.relationship_List_Images.allObjects;
            NSArray *imagesNamesArray = [listImagesArray valueForKey:@"image"];

            UIImage* thumbnail = [[UIImage imageWithData:[imagesNamesArray objectAtIndex:0]] fixToCorrectOrientation:160 compressionQuality:1.0]; //[UIImage imageWithData:[imagesNamesArray objectAtIndex:0]];
            if (thumbnail) {
                dispatch_async(dispatch_get_main_queue(), ^{
                    //return to the main thread to update the UI
                    if ([[self.tableView indexPathsForVisibleRows] containsObject:indexPath]) {
                        //check that the relevant data is still required
                        MasterViewControllerCell * correctCell = (MasterViewControllerCell *)[self.tableView cellForRowAtIndexPath:indexPath];
                        //get the correct cell (it might have changed)
                        correctCell.imageViewPhoto.image = thumbnail; // CRASHES HERE
                    }
                });
            }
            cell.imageViewPhoto.hidden = NO;
        });
       ....

Does not crash

        NSArray *listImagesArray = list.relationship_List_Images.allObjects;
        NSArray *imagesNamesArray = [listImagesArray valueForKey:@"image"];
        cell.imageViewPhoto.image =  [[UIImage imageWithData:[imagesNamesArray objectAtIndex:0]] fixToCorrectOrientation:160 compressionQuality:1.0]; //[UIImage imageWithData:[imagesNamesArray objectAtIndex:0]];
        cell.imageViewPhoto.hidden = NO;
        cell.labelNoteRightMarginContraint.constant = 100;

Thank you.

Support for multiple sections?

Hello,

I want to be able to reorder cells within a particular section. As my tableview has multiple sections, I can't use this pod as it only allows 1 section per tableview. How can I achieve what I want?

Thanks

Crash when dragging off end of table

To reproduce:

  • implement tableView: targetIndexPathForMoveFromRowAtIndexPath: toProposedIndexPath: in table view delegate
  • try to drag off the bottom of the table
  • crash

The crash is in HPReorderTableView.m, - (void)updateCurrentLocation:(UILongPressGestureRecognizer *)gesture. toIndexPath is nil which results in a crash. A possible fix is:

if ([self.delegate respondsToSelector:@selector(tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:)])
{
    if (toIndexPath == nil) {
        return;
    }
        
    toIndexPath = [self.delegate tableView:self targetIndexPathForMoveFromRowAtIndexPath:_reorderInitialIndexPath toProposedIndexPath:toIndexPath];
}

Cells ordering gets messed up when dragging one cell quickly.

Hi hpique, thanks a lot for this wonderful tableview. While playing around with the demo app, I found a pretty serious bug... I have made gif demonstrating the same.

temp

When I long press on a cell and then move it around very quickly (in both directions - up and down), the ordering of the other cells gets messed up.

For example, in the gif above, look at the cell 4. It gets stuck to the cell that I am currently dragging around. And when I leave the cell 1, a blank space is found where actually the cell 4 should have been.

Also, when dragging the cell over long distance (in both directions, quickly), the ordering of other cells in the table view gets haphazard. If this bug is difficult to reproduce, please do ask to clarify, I'll be happy to make other gifs with more detailed description to sort this bug out.

Thanks again, hpique!

Swipe to Delete

I have a question, now that I am using HPReorderTableView the swipe to show the Delete Button no longer works.

Is there a way to enable it again? I already tried below.

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {    
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        //NSLog(@"FIRST_DELETE");
        NSFetchedResultsController *frc = [self frcFromTV:tableView];
        List *deleteTarget = [frc objectAtIndexPath:indexPath];
        [frc.managedObjectContext deleteObject:deleteTarget];
        [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                         withRowAnimation:UITableViewRowAnimationFade];
    }

Thank you

Post-reorder static UIImage covers cell animation

This works well - nicely done! The only issue I'm having is that before the reorder, my cells have an animation going, on endless loop. I don't mind the fact that while dragging, the content is replaced by a static screenshot UIImage of the cell (that actually feels intuitive for the user) but after the drop in the new location, the static screenshot is over the top of my actual cell and hence I can't see the animation. Am I doing something wrong or is there some way to remove the static image after the reorder?

HPReorderTableView subclass shows a copy of the cell behind when the table view is its own data source

Hey, firstly, thank you so much for this project, great time saver.

I subclassed the tableview so that I could reuse it later. Unfortunately this caused a funny side effect: when I am in reordering mode, the reordered cell leaves behind a copy of itself. So instead of the white empty cell, you actually see a copy of the cell. Do you know why this might happen?

I was able to get rid of this effect by not subclassing the tableview, but that way did not allow me to override functions like canMoveRowAtIndexPath or canEditRowAtIndexPath. Any help would be greatly appreciated. Thanks!

The animation differs after long pressing each cell

Hi, thanks for the nice library.

However, the pop up animation differs every time I long press each tableview cell, sometimes it pops to the upper side, sometimes it pops to the below.

Is there any way to show only one pop animation after long pressing?

Selected row color

Hi hpique,
thanks for this fantastic library, it works great and saved me a lot of time.
I don't have any problem regards the functionality of the library, I'm able to move the cells and trigger the associated action, my issue is a cosmetic issue: when a cell is selected by a long press gesture and is moving it becomes BLACK... when the cell is just selected the color is BLUE
How can I change this color and make it transparent ( or any other color)?

This is the code I'm using to try to customise the cell:

((HPReorderTableView *)self.tableView).reorderDragView.layer.shadowColor = UIColorFromRGB(0x89BAE9).CGColor;
((HPReorderTableView *)self.tableView).reorderDragView.backgroundColor = [UIColor clearColor];
[((HPReorderTableView *)self.tableView)registerTemporaryEmptyCellClass:SCSpotCell.class];

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorColor = [UIColor colorWithWhite:1 alpha:0.2];
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, self.bottomLayoutGuide.length, 0);

Thanks
Emilio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.