views:

369

answers:

2

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];

}

A: 

Is this included in your code?

[self.contentView addSubview:SLIDINGVIEW];

We need to look at your animation block and the code that invokes your animation

JustinXXVII
A: 

I solved this problem Myself. I ended up using a custom Subclass of UITableViewCell outlined in 'Beginning iPhone Development' pp 205-208.

I put a button in the NIB for my cell, with one view for the normal view, and another for the menu. When the button was pushed. The main view slides out of the way. All of these methods and buttons were included in the subClass. Boom. done.

monotreme