views:

212

answers:

1

I'm using the following code to make a small view disappear at the bottom of the screen:

int y_dest = self.application.windows.frame.size.height; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.33f]; [UIView setAnimationDelegate:self]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(closeAnimationDidStop:finished:context:)]; self.view.frame = CGRectMake(0, y_dest, self.view.frame.size.width, self.view.frame.size.height); [UIView commitAnimations];

This works perfectly when the view is at the bottom of the screen but now I have to add it to the window above a TabBar meaning that the view is now animated over the top of the tabbar rather than behind it. Is there any way to have the view "disappear" behind the tabbar?

I've tried a combination of things so far including creating a "mask" view of the same size as the animated view and placing that in the window but for some reason that view did not appear at all. I also tried using insertSubview:belowSubview which made no difference. I'm sure I must be missing something here.

Thanks in advance!enter code here

A: 

Hi Jason

Is it:

[self bringSubviewToFront:yourView] you are looking for?

RickiG
I tried a few combinations of bringSubviewToFront and sendSubviewToBack without any luck but I have now figured it out. The problem was down to the fact that I was removing my hiding window from the view, then after the animation, adding it back to the navigationController view but because I had popped the view off the navigationController stack it was no longer valid so by keeping a reference to the navigationController view before the pop, I could add it back after the animation and it works beautifully!
Jason