views:

30

answers:

1

Hi everyone,

I would like to pop-up a subview pop-up from one of the actions performed by a button placedon a tableview controller.

I initially added a sub-view(initally hidden below the screen) and later want to animate it to animate and pop-up. Here is the code for the button action

-(IBAction) finalShareVerse: (id) sender
{
    NSLog(@"finalShare Button");
    UIView *tempView;
    CGRect tmpFrame;
    tempView = [[[UIView alloc] initWithFrame:CGRectMake(0, 490, 320, 90)] 
         autorelease];
    [tempView setBackgroundColor:[UIColor blackColor]];
    [tempView setAlpha:.87];
    [self.view addSubview:tempView];

    tmpFrame = tempView.frame;
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:.75];
    tmpFrame.origin.y=390;
    self.view.frame=tmpFrame;
    [UIView commitAnimations];
}

The problem is that now the parent controller gets animated and popped down instead of the subview to be popped up. Is there a way to specify the animation to trigger on only the sub view.

I am new to iPhone app dev.. Please advise.

A: 

If I understand correctly, the problem is the line:

self.view.frame=tmpFrame;

You are applying the change of position to the view rather than the tmpView

NWCoder
@NWCoder: Thanx for this ... The problem was that tempView is a local variable to the function.. Once I made it an instance variable it worked fine ... thnx again.
tomkaith13