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

When swipeTableCell is called in a searchview cant identify tableview #28

Closed
Ergul opened this issue Nov 3, 2014 · 3 comments
Closed

Comments

@Ergul
Copy link

Ergul commented Nov 3, 2014

Hi,

here is my source:

-(BOOL) swipeTableCell:(MGSwipeTableCell*) cell tappedButtonAtIndex:(NSInteger) index direction:(MGSwipeDirection)direction fromExpansion:(BOOL) fromExpansion
{

    static NSString *CellIdentifier = @"cell";
    NSIndexPath * indexpath = [self.tableView indexPathForCell:cell];

    Kids *aKid = nil;

    if (self.tableView == self.searchDisplayController.searchResultsTableView) {
        aKid = [searchResults objectAtIndex:indexpath.row];
    } else {
        aKid = [kids objectAtIndex:indexpath.row];
    }

}

self.tableView == self.searchDisplayController.searchResultsTableView
is always false...

thanks in advance,

Eric

PS: Your control is very nice, continue!

@MortimerGoro
Copy link
Owner

Hi Eric.

I have just tested MGSwipeTableCell with searchDisplayController. The bug seems to be in your code, try this:

-(BOOL) swipeTableCell:(MGSwipeTableCell*) cell tappedButtonAtIndex:(NSInteger) index direction:(MGSwipeDirection)direction fromExpansion:(BOOL) fromExpansion
{

    static NSString *CellIdentifier = @"cell";
    NSIndexPath * indexpath = [self.tableView indexPathForCell:cell];

    Kids *aKid = nil;

    if (!indexPath) {
         indexPath = [self.searchDisplayController.searchResultsTableView indexPathForCell:cell];
        aKid = [searchResults objectAtIndex:indexpath.row];
    } else {
        aKid = [kids objectAtIndex:indexpath.row];
    }

}

@Ergul
Copy link
Author

Ergul commented Nov 11, 2014

Hi MortimerGoro,

excellent! It works!

thank you very much.

best regards,

Eric

@ozzba
Copy link

ozzba commented Jan 16, 2016

I have the same problem.
Your solution works great.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants