2
3 - (NSArray *)swipeTableCell:(MGSwipeTableCell *)cell swipeButtonsForDirection:(MGSwipeDirection)direction swipeSettings:(MGSwipeSettings *)swipeSettings expansionSettings:(MGSwipeExpansionSettings *)expansionSettings {
4 //左边
5 expansionSettings.fillOnTrigger = YES;
6 if (direction == MGSwipeDirectionLeftToRight) {
7
8 //返回的数组必须是button类型的
9 return @[[MGSwipeButton buttonWithTitle:@"哈哈" icon:nil backgroundColor:[UIColor redColor] padding:15 callback:^BOOL(MGSwipeTableCell * sender){
10 NSLog(@"Convenience callback received (left).");
11 return YES;
12 }],[MGSwipeButton buttonWithTitle:@"哈哈" icon:nil backgroundColor:[UIColor redColor] padding:15 callback:^BOOL(MGSwipeTableCell * sender){
13 NSLog(@"Convenience callback received (left).");
14 return YES;
15 }]];
16 }
17 //右边
18 else {
19 UIButton *view = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 30, 30)];
20 view.userInteractionEnabled = YES;
21 view.backgroundColor = [UIColor yellowColor];
22 return @[view];
23 }
24 }
25
26
27 - (BOOL)swipeTableCell:(MGSwipeTableCell *)cell tappedButtonAtIndex:(NSInteger)index direction:(MGSwipeDirection)direction fromExpansion:(BOOL)fromExpansion {
28 NSLog(@"%ld:%ld ",index,direction);
29 return YES;
30 }