UITableView-Reorder icon indicating copy to clipboard operation
UITableView-Reorder copied to clipboard

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

Open plandem opened this issue 10 years ago • 9 comments

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?

plandem avatar Apr 09 '15 15:04 plandem

if i use like this:

- (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;
    } else {
        cell.hidden = NO;
        [self configureCell:cell atIndexPath:indexPath];
    }

    return cell;
}

then everything looks fine

plandem avatar Apr 09 '15 15:04 plandem

I guess you're using the automatic rowHeight?

Check this https://github.com/LavaSlider/UITableView-Reorder/issues/4

nico75005 avatar Apr 09 '15 21:04 nico75005

nope, i woud like to use this new feature of IOS tables, but for me it somehow does not work. So my height came from:

-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

and as i said, if i set:

 if( [tableView shouldSubstitutePlaceHolderForCellBeingMovedAtIndexPath: indexPath] ) {
        cell.hidden = YES;
    } else {
        cell.hidden = NO;
        [self configureCell:cell atIndexPath:indexPath];
    }

everything is working fine!

plandem avatar Apr 10 '15 03:04 plandem

What do you put inside -(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath ?

nico75005 avatar Apr 10 '15 03:04 nico75005

as you wrote at readme:

-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    indexPath = [tableView dataSourceIndexPathFromVisibleIndexPath: indexPath];
    return (([indexPath compare:self.selectedIndexPath] != NSOrderedSame) ? cellHeightCollapsed : cellHeightExpanded);
}

plandem avatar Apr 10 '15 03:04 plandem

but it has nothing with height, it's hidden. if i 'patch' hidden property, then everything is fine

plandem avatar Apr 10 '15 03:04 plandem

First, I didn't write the readme ;), second, what does happen when you write it like this:

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

[self configureCell:cell atIndexPath:indexPath];

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

return cell;

}`

nico75005 avatar Apr 10 '15 03:04 nico75005

well, it's very strange: at one viewcontroller - everything is ok:

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

    UITableViewCell *cell;

    if([indexPath compare:self.selectedIndexPath] == NSOrderedSame)
        cell = [tableView dequeueReusableCellWithIdentifier:@"WorkoutCellExpanded" forIndexPath:indexPath];
    else
        cell = [tableView dequeueReusableCellWithIdentifier:@"WorkoutCellCollapsed" forIndexPath:indexPath];

    [self configureCell:cell atIndexPath:indexPath];
    if( [tableView shouldSubstitutePlaceHolderForCellBeingMovedAtIndexPath: indexPath] ) {
        cell.hidden = YES;
    }

    return cell;
}

, but at another still same problems:

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

    WorkoutExerciseListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"WorkoutExerciseListCell" forIndexPath:indexPath];

    [self configureCell:cell atIndexPath:indexPath];

    if( [tableView shouldSubstitutePlaceHolderForCellBeingMovedAtIndexPath: indexPath] ) {
        cell.hidden = YES;
    }

    return cell;
}

plandem avatar Apr 10 '15 04:04 plandem

but my workaround with 'hidden=NO' as i wrote before - works fine in both cases

plandem avatar Apr 10 '15 04:04 plandem