Skip to content

Instantly share code, notes, and snippets.

@jimrutherford
Created September 19, 2013 17:58
Show Gist options
  • Save jimrutherford/6627337 to your computer and use it in GitHub Desktop.
Save jimrutherford/6627337 to your computer and use it in GitHub Desktop.
@protocol TLSwipeForOptionsCellDelegate <NSObject>
/**
Tells the delegate that the specified cell’s menu is now shown or hidden.
@param cell The cell whose menu was shown or hidden.
@param isShowingMenu `YES` if the menu was shown; otherwise, `NO`.
*/
- (void)cell:(TLSwipeForOptionsCell *)cell didShowMenu:(BOOL)isShowingMenu;
/**
Tells the delegate that the specified cell’s “Delete” button is pressed.
@param cell The cell whose “Delete” button was pressed.
*/
- (void)cellDidSelectDelete:(TLSwipeForOptionsCell *)cell;
/**
Tells the delegate that the specified cell’s “More” button is pressed.
@param cell The cell whose “More” button was pressed.
*/
- (void)cellDidSelectMore:(TLSwipeForOptionsCell *)cell;
/**
Tells the delegate that the specified row was seleceted.
@param cell The cell whose “More” button was pressed.
*/
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
@end
- (void) setup {
// all the other code in Ash's example
// add a tap gesture recognizer
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cellTapped:)];
[scrollViewContentView addGestureRecognizer:tapRecognizer];
}
// Respond to our Tap Gesture Recognizer
- (void) cellTapped:(UITapGestureRecognizer*)tapGesture
{
//set Selected State
// whatever you want to do to make this look hot
// send a delegate message
if ([self.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]){
UITableView *table = (UITableView *)[self superview];
// heirarchy is differeent in iOS7
if (![table isKindOfClass:[UITableView class]])
{
table = (UITableView *)self.superview.superview;
}
NSIndexPath *indexPath = [table indexPathForCell:self];
[self.delegate tableView:table didSelectRowAtIndexPath:indexPath];
}
}
@arkan
Copy link

arkan commented Oct 14, 2013

Thanks for the idea. It solved my issue :-)

@mariash
Copy link

mariash commented Jul 14, 2014

Thanks!

@bawn
Copy link

bawn commented Aug 31, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment