Created
September 19, 2013 17:58
-
-
Save jimrutherford/6627337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!