Giter Club home page Giter Club logo

uitableview-reorder's People

Contributors

lavaslider 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

uitableview-reorder's Issues

Custom Cells ?

Hi, I use a custom cell for my table view, which has these properties:

#import <UIKit/UIKit.h>
@interface DragAndDropPeopleCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *peoplepic;
@property (weak, nonatomic) IBOutlet UILabel *PlaceNum;
@property (weak, nonatomic) IBOutlet UIImageView *CellNumRoundedImage;
@property (weak, nonatomic) IBOutlet UILabel *Name;
@end

I'd like to know how to update these outlets instead of juste the cell's text when finishing moving a row
Thanks

Snapshot appearing at the wrong location with UITableViewAutomaticDimension affected to rowHeight

On the demo project, add

self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 44.0;

in viewDidLoad of FirstTableViewController and run the project.

Go to the tabBarItem first and then scroll to the bottom and make a longPress on any visible row. The first long press will have the snapshot appearing in a wrong location. Do it again and it's okay except there is quick and small move down and up of the whole tableView. I noticed it only appears when the last row is visible.

--

if the last section is empty and you try to drop a element into the section you will get following error:

2015-11-03 12:11:57.737 UITableView+Reorder[2943:75589] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[**NSArrayM objectAtIndex:]: index 18446744073709551615 beyond bounds for empty array'
* First throw call stack:
(
0 CoreFoundation 0x000000010f4bff45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010ef39deb objc_exception_throw + 48
2 CoreFoundation 0x000000010f3a39e4 -[__NSArrayM objectAtIndex:] + 212
3 UITableView+Reorder 0x000000010d2d79f3 -[SecondTableViewController tableView:heightForRowAtIndexPath:] + 323
4 UIKit 0x000000010d9145cf __66-[UISectionRowData refreshWithSection:tableView:tableViewRowData:]_block_invoke + 240
5 UIKit 0x000000010d913c5f -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 4876
6 UIKit 0x000000010d916898 -[UITableViewRowData ensureAllSectionsAreValid] + 109
7 UIKit 0x000000010d6e7132 -[UITableView _endCellAnimationsWithContext:] + 598
8 UITableView+Reorder 0x000000010d2d0900 -[UITableView(Reorder) movePlaceHolderRowFromIndexPath:toIndexPath:] + 640
9 UITableView+Reorder 0x000000010d2cf9b0 -[UITableView(Reorder) movePlaceHolderRowIfNeeded] + 8704
10 UITableView+Reorder 0x000000010d2cd5dd -[UITableView(Reorder) movingRowIsAtPoint:] + 4029
11 UITableView+Reorder 0x000000010d2cbee4 -[UITableView(Reorder) rowReorderGesture:] + 372
12 UIKit 0x000000010daa394f _UIGestureRecognizerSendTargetActions + 153
13 UIKit 0x000000010da9ffc1 _UIGestureRecognizerSendActions + 162
14 UIKit 0x000000010da9dfbe -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 843
15 UIKit 0x000000010daa6283 ___UIGestureRecognizerUpdate_block_invoke898 + 79
16 UIKit 0x000000010daa6121 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 342
17 UIKit 0x000000010da93bdd _UIGestureRecognizerUpdate + 2634
18 UIKit 0x000000010d6319c0 -[UIWindow _sendGesturesForEvent:] + 1137
19 UIKit 0x000000010d632bf6 -[UIWindow sendEvent:] + 849
20 UIKit 0x000000010d5e22fa -[UIApplication sendEvent:] + 263
21 UIKit 0x000000010d5bcabf _UIApplicationHandleEventQueue + 6844
22 CoreFoundation 0x000000010f3ec011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 17
23 CoreFoundation 0x000000010f3e1f3c __CFRunLoopDoSources0 + 556
24 CoreFoundation 0x000000010f3e13f3 __CFRunLoopRun + 867
25 CoreFoundation 0x000000010f3e0e08 CFRunLoopRunSpecific + 488
26 GraphicsServices 0x0000000112470ad2 GSEventRunModal + 161
27 UIKit 0x000000010d5c230d UIApplicationMain + 171
28 UITableView+Reorder 0x000000010d2d61df main + 111
29 libdyld.dylib 0x000000011018192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Only seems to work on first rearranging

Hi,

It seems to work great on first rearranging, but I can't get it to work the second time:
When I long press a cell for the second time, immediately after I begin to drag it, it's sent at the first row without any animation.
It's occurring in your test app as well.

Furthermore, even with

- (BOOL) tableView: (UITableView *) tableView canMoveRowAtIndexPath: (NSIndexPath *) indexPath
{
    return indexPath.row != 0;
}
- (BOOL) tableView: (UITableView *) tableView canEditRowAtIndexPath: (NSIndexPath *) indexPath
{
    return indexPath.row != 0;
}

I can drag my second cell at first position. Shoudn't 1st cell be unmovable with this ?

Thanks

Is there a bug when using tableView.rowHeight = UITableViewAutomaticDimension ?

Hello there!

First of all, thanks for this library, it saved me a lot of time, especially regarding the scrolling part.

I have a swift project where I'm using your UITableView-Reorder. Everything works fine up until I had those two lines in viewDidLoad of my UITableViewController:

tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 65.0

Then I get huge white space right under the row I'm trying to move like this:

long_press

When I remove my finger without moving the row, the snapshot of the row go to the middle of the blank space and then everything comes back in order:

screen shot 2015-04-04 at 09 43 38

Are you aware of such a problem or it comes from my project only?
I used adjustedValueForReorderingOfRowCount, shouldSubstitutePlaceHolderForCellBeingMovedAtIndexPath and tableView:moveRowAtIndexPath:toIndexPath as explained.

cocoapods?

any reason why still not at cocoapods actually?

Can't make it to work - hidden it break the logic

i used everything from your readme and when i use:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    indexPath = [tableView dataSourceIndexPathFromVisibleIndexPath: indexPath];

    WorkoutExerciseListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WorkoutExerciseListCell" forIndexPath:indexPath];
    if( [tableView shouldSubstitutePlaceHolderForCellBeingMovedAtIndexPath: indexPath] ) {
        cell.hidden = YES;
        return cell;
    }

    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

then each row hides after drop. Here is result with 'hidden = YES'
https://www.dropbox.com/s/qsmj02kddo1wlds/bug%20sort%201.mov?dl=0

and here is result with 'hidden = NO', everything looks like fine except that sometimes there is 'non-configured' cell (at my video it has name "name of timer":
https://www.dropbox.com/s/xfbmharmie0lj4x/bug%20sort%202.mov?dl=0

what to do? What i missed?

Last section empty

if the last section is empty and you try to drop a element into the section you will get following error:

2015-11-03 12:11:57.737 UITableView+Reorder[2943:75589] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 18446744073709551615 beyond bounds for empty array'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f4bff45 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010ef39deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010f3a39e4 -[__NSArrayM objectAtIndex:] + 212
    3   UITableView+Reorder                 0x000000010d2d79f3 -[SecondTableViewController tableView:heightForRowAtIndexPath:] + 323
    4   UIKit                               0x000000010d9145cf __66-[UISectionRowData refreshWithSection:tableView:tableViewRowData:]_block_invoke + 240
    5   UIKit                               0x000000010d913c5f -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 4876
    6   UIKit                               0x000000010d916898 -[UITableViewRowData ensureAllSectionsAreValid] + 109
    7   UIKit                               0x000000010d6e7132 -[UITableView _endCellAnimationsWithContext:] + 598
    8   UITableView+Reorder                 0x000000010d2d0900 -[UITableView(Reorder) movePlaceHolderRowFromIndexPath:toIndexPath:] + 640
    9   UITableView+Reorder                 0x000000010d2cf9b0 -[UITableView(Reorder) movePlaceHolderRowIfNeeded] + 8704
    10  UITableView+Reorder                 0x000000010d2cd5dd -[UITableView(Reorder) movingRowIsAtPoint:] + 4029
    11  UITableView+Reorder                 0x000000010d2cbee4 -[UITableView(Reorder) rowReorderGesture:] + 372
    12  UIKit                               0x000000010daa394f _UIGestureRecognizerSendTargetActions + 153
    13  UIKit                               0x000000010da9ffc1 _UIGestureRecognizerSendActions + 162
    14  UIKit                               0x000000010da9dfbe -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 843
    15  UIKit                               0x000000010daa6283 ___UIGestureRecognizerUpdate_block_invoke898 + 79
    16  UIKit                               0x000000010daa6121 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 342
    17  UIKit                               0x000000010da93bdd _UIGestureRecognizerUpdate + 2634
    18  UIKit                               0x000000010d6319c0 -[UIWindow _sendGesturesForEvent:] + 1137
    19  UIKit                               0x000000010d632bf6 -[UIWindow sendEvent:] + 849
    20  UIKit                               0x000000010d5e22fa -[UIApplication sendEvent:] + 263
    21  UIKit                               0x000000010d5bcabf _UIApplicationHandleEventQueue + 6844
    22  CoreFoundation                      0x000000010f3ec011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    23  CoreFoundation                      0x000000010f3e1f3c __CFRunLoopDoSources0 + 556
    24  CoreFoundation                      0x000000010f3e13f3 __CFRunLoopRun + 867
    25  CoreFoundation                      0x000000010f3e0e08 CFRunLoopRunSpecific + 488
    26  GraphicsServices                    0x0000000112470ad2 GSEventRunModal + 161
    27  UIKit                               0x000000010d5c230d UIApplicationMain + 171
    28  UITableView+Reorder                 0x000000010d2d61df main + 111
    29  libdyld.dylib                       0x000000011018192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

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.