MortimerGoro / MGSwipeTableCell

An easy to use UITableViewCell subclass that allows to display swippable buttons with a variety of transitions.
MIT License
6.97k stars 1.08k forks source link

Possible issue with multiple sections #93

Closed acfriedman closed 9 years ago

acfriedman commented 9 years ago

I have two sections, one swipable and one not swipable.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath      *)indexPath
  {
      static NSString *identifier1 = @"Playlists";
     static NSString *identifier2 = @"Songs";

    if (indexPath.section == 0) {
       SAPlaylistsCustomCell *cell = (SAPlaylistsCustomCell *)[tableView     dequeueReusableCellWithIdentifier:identifier1];

    NSDictionary *playlist = self.playlists[indexPath.row];
    cell.searchPlaylistName.text = playlist[@"title"];
    if (self.playlists.count == 5 && indexPath.row == 4) {
        cell.searchPlaylistName.text = @". . .";
    }
    return cell;
 }
  else {
   SASearchCustomCell *cell = (SASearchCustomCell *)[tableView     dequeueReusableCellWithIdentifier:identifier2];

    cell.searchDelegate = self;
    cell.delegate = self;

    cell.backgroundView = nil;
    [cell hideCellContents:NO];

    //Populate the cell with the data recieved from the search.
    NSDictionary *track = self.songs[indexPath.row];
    [cell setCellWithTrack:track];
    return cell;
}

}

My SASearchCustomCell is a subclass of MGSwipeTableCell. When I attempt to swipe reused cells that are of SASearchCustomCell class I get this exception thrown.

*\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SAPlaylistsCustomCell cancelPanGesture]: unrecognized selector sent to instance 0x7dddeab0'

My SAPlaylistCustomCell definitely doesn't have a panGesture on it.

hcordray218 commented 9 years ago

I was having the same issue--I'm using multiple cell classes in one section, some being subclasses of MGSwipeTableCell, some not. I was able to get past this by just including this in the cells that weren't subclasses MGSwipeTableCell:

@implementation ThisCellShouldNotSwipe
- (void)cancelPanGesture{}
@end
MortimerGoro commented 9 years ago

Fixed in 1.4.3