I'm attempting to implement a slide-in menu like in the facebook app.
I have a NIB for a custom UITableViewCell, which includes a button. The button has an IBAction associated with it, in which I animate in a subview of my NIB (the delete/edit menu).
My problem is that my animation only happens on one cell, and its not the cell where I pushed the button.
How would I call this animation to work on the cell where my button was tapped? Here's my code so far. Any tips?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *PatientCellIdentifier = @"PatientCellIdentifier";
PatientListTableViewCell *cell = (PatientListTableViewCell *)[tableView dequeueReusableCellWithIdentifier:PatientCellIdentifier];
if (cell ==nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"PatientCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellBG.png"]];
}
//NSUInteger row = [indexPath row];
//NSDictionary *rowData = [self.
[self configureCell:cell atIndexPath:indexPath];
return cell; }
-(IBAction)showMenu:(id)sender{
[self showMenuForCell:sender animated:YES];}
- (void)showMenuForCell:(UITableViewCell *)cell animated:(BOOL)animated {
//[super showMenu:view forCell:cell animated:animated];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
//Action here
[UIView commitAnimations];
}