uitableviewcontroller edit Row at index not working with uipageviewcontroller

205 views Asked by At

i have a UIPageViewController that holds a bunch of viewcontrollers. One of the child view controllers is a uitableviewcontroller which has certain rows that can be edited/deleted

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0  || indexPath.row == 1 || indexPath.row == 2 || (indexPath.row == 3 && hasMore) || indexPath.row == 1 + 1 + 1 + 1 + self.media.comments.count - 1 + (hasMore ? 1 : 0)){
    return NO;
}
Comment *comment = [self.media.comments objectAtIndex:(indexPath.row - 3 - (hasMore ? 1 : 0))];
if (comment.user.userId != [Data sharedInstance].currentUser.userId)
    return NO;
return YES;

}

my problem now is that since i have a uipageviewcontroller as the parent when i swipe on one of the cells that should be editable the uipageviewcontroller gets the touches and changes page instead of the table receiving the touches and showing the edit menu

any ideas out there?

Thanks Chris

1

There are 1 answers

0
Christopher Rivera On

i actually found out that you can use this third party library which will allow the swipe gesture of the menu to have president over the uipageviewcontroller swipe

https://github.com/WinterKirk/MKSlidingTableViewCell

the important thing is that your whole view shouldnt only have these kind of cells cause then the uipageviewcontroller wont be able to swipe

but it works great in situations where you lets say have an image and comments under it and people should be able to delete the comments but swipe to the next pic on all other cells