Various styles of gesture sliding Cell

Various styles of gesture sliding Cell

Source code introduction

MGSwipeTableCell is a subclass of UITableViewCell that displays clickable buttons in a variety of transition methods. The library is compatible with all different ways to create UITableViewCell.
Source code running screenshot

Source code snippet

  1. #pragma mark Trigger Actions
  2.   
  3. -( void ) handleClick: (id) sender fromExpansion:(BOOL) fromExpansion
  4. {
  5. bool autoHide = false ;
  6. #pragma clang diagnostic push
  7. #pragma clang diagnostic ignored "-Wundeclared-selector"  
  8. if ([sender respondsToSelector: @selector (callMGSwipeConvenienceCallback:)]) {
  9. //call convenience block callback if exits (usage of MGSwipeButton class is not compulsory)  
  10. autoHide = [sender performSelector: @selector (callMGSwipeConvenienceCallback:) withObject:_cell];
  11. }
  12. #pragma clang diagnostic pop
  13.       
  14. if (_cell.delegate && [_cell.delegate respondsToSelector: @selector (swipeTableCell:tappedButtonAtIndex:direction:fromExpansion:)]) {
  15. NSInteger index = [_buttons indexOfObject:sender];
  16. if (!_fromLeft) {
  17. index = _buttons.count - index - 1 ; //right buttons are reversed  
  18. }
  19. autoHide|= [_cell.delegate swipeTableCell:_cell tappedButtonAtIndex:index direction:_fromLeft ? MGSwipeDirectionLeftToRight : MGSwipeDirectionRightToLeft fromExpansion:fromExpansion];
  20. }
  21.       
  22. if (fromExpansion) {
  23. _expandedButton = nil;
  24. _cell.swipeOffset = 0 ;
  25. }
  26. else   if (autoHide) {
  27. [_cell hideSwipeAnimated:YES];
  28. }
  29.   
  30. }

Source code download: http://download..com/data/1985034

<<:  Forward SMS to a specified mobile number by keyword

>>:  96% of mobile malware targets Android: More than 5 billion apps can be attacked

Recommend

Analyst: Three reasons why Apple miscalculated its quarterly revenue

Speaking of mistakes, overestimating a company...

Why do your glasses reflect light when you take photos?

Produced by: Science Popularization China Produce...

Why do airplane meals taste so bad? It may not be the food that’s to blame

When you are on an airplane, you may have had thi...

12 pictures to understand Microsoft's 40 years

Last weekend (April 4), Microsoft quietly ushered...

How to acquire high-value and accurate users at low cost?

Before a product goes online, if you are an opera...

Why do some bank card numbers have 16 digits and some have 19 digits?

Do you know what the numbers on your ID card repr...

Status bar prompts with various effects

Source code introduction The demo can provide a v...

【WeChat circle assessment period adjustment】V2.0.1

【WeChat circle assessment period adjustment】 V2.0...