Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UITableView+LongPressReorder.m #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion UITableView+LongPressReorder/UITableView+LongPressReorder.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ @interface LPRTableViewProxy : NSObject <LPRTableViewDelegate>
@property (nonatomic, strong) NSIndexPath *initialIndexPath;
@property (nonatomic, strong) UIView *draggingView;

// Use Custom Cell
@property (nonatomic) BOOL useCustomCell;

@end


Expand All @@ -38,6 +41,9 @@ - (instancetype)initWithTableView:(UITableView *)tableView {
_canReorder = YES;
_draggingViewOpacity = 0.85;
_longPress.enabled = _canReorder;

// Use Custom Cell
_useCustomCell = NO;
}

return self;
Expand Down Expand Up @@ -125,6 +131,12 @@ - (void)longPress:(UILongPressGestureRecognizer *)gesture {
}
// dragging
else if (gesture.state == UIGestureRecognizerStateChanged) {
// Added - When using a Custom Cell while dragging the cell on the new row does not stay hidden (while dragging)
if (_useCustomCell) {
UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
cell.hidden = YES;
}

// update position of the drag view
// don't let it go past the top or the bottom too far
if (location.y >= 0 && location.y <= _tableView.contentSize.height + 50) {
Expand Down Expand Up @@ -305,4 +317,9 @@ - (LPRTableViewProxy *)lprProxy {
return proxy;
}

@end
// Use Custom Cell
- (void)setUseCustomCell:(BOOL)useCustomCell {
[self lprProxy].useCustomCell = useCustomCell;
}

@end