I've found a problem with swipe to delete while using ECSlidingViewController. Before iOS7 i use this trick:
#pragma mark - SwipeToDelete+SwipeMenu trick
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return YES;
}
But now this doesn't work.
From official git repository i download example project and change settings table view controller for demonstrate issue:
#import "MESettingsViewController.h"
#import "MEDynamicTransition.h"
#import "UIViewController+ECSlidingViewController.h"
@interface MESettingsViewController ()
@property (nonatomic, strong) UIPanGestureRecognizer *dynamicTransitionPanGesture;
@end
@implementation MESettingsViewController
NSMutableArray *objects;
- (void)viewDidLoad
{
[super viewDidLoad];
objects = [[NSMutableArray alloc] init];
[objects addObject:@"the"];
[objects addObject:@"world"];
[objects addObject:@"is"];
[objects addObject:@"mine"];
[self.tableView reloadData];
}
#pragma mark - UIViewController
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if ([(NSObject *)self.slidingViewController.delegate isKindOfClass:[MEDynamicTransition class]]) {
MEDynamicTransition *dynamicTransition = (MEDynamicTransition *)self.slidingViewController.delegate;
if (!self.dynamicTransitionPanGesture) {
self.dynamicTransitionPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:dynamicTransition action:@selector(handlePanGesture:)];
}
[self.navigationController.view removeGestureRecognizer:self.slidingViewController.panGesture];
[self.navigationController.view addGestureRecognizer:self.dynamicTransitionPanGesture];
} else {
[self.navigationController.view removeGestureRecognizer:self.dynamicTransitionPanGesture];
[self.navigationController.view addGestureRecognizer:self.slidingViewController.panGesture];
}
}
#pragma mark - IBActions
- (IBAction)menuButtonTapped:(id)sender {
[self.slidingViewController anchorTopViewToRightAnimated:YES];
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return objects.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = [objects objectAtIndex:indexPath.row];
return cell;
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[objects removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
#pragma mark - SwipeToDelete+SwipeMenu trick
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return YES;
}
@end
Just copy and paste this code to MESettingsViewController.m, run application, switch to Settings menu item and try swipe to delete. It doesn't work.
Please, help me fix it.