My apps MainViewController uses a UITableView
with custom UITableViewCells
from CustomCell. With UIPanGestureRecognizer
the user can slide a cell left or right. After the slide, the textLabel.text
and slide direction are stored to static NSStrings
.
The animation code is CustomCell and works fine.
How could MainViewController know or be notified when CustomCell's recognizer.state == UIGestureRecognizerStateEnded
?
CustomCell
static NSString *cellAction = NULL; // textLabel.text
static NSString *slideTo = NULL; // slide direction
-(id)initWithStyle{
UIGestureRecognizer* recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self addGestureRecognizer:recognizer];
}
-(void)handlePan:(UIPanGestureRecognizer *)recognizer{
}
MainViewController
-(void)viewDidLoad{
actionTable = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
[self.view addSubview:middleActionTable];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:ident forIndexPath:indexPath];
return cell;
}
After this works I plan on using the 2 static strings from CustomCell to perform a modal segue from MainViewController to AnotherViewController. I only need the 2 strings after the slide action.