Is this possible?
I want to change the alpha value of the navigation bar in my view controller (in an animation), but if I do self.navigationController.navigat
If you just want to get rid of the navigationBar in an animated way you could do:
[self.navigationController setNavigationBarHidden:YES animated:YES];
If you want to control the animation and its necessary to set the alpha to 0.0, read on:
The "black box" you are seeing is from the underlying view or window. If you just want your views color instead of the "black box" do:
self.navigationController.view.backgroundColor = self.view.backgroundColor;
[UIView animateWithDuration:1.0 delay:1.0 options:0 animations:^{
self.navigationController.navigationBar.alpha = 0.0;
} completion:NULL];
If you want your actual view to be where the navigationBar was, you need to increase the height of your view:
[UIView animateWithDuration:1.0 delay:1.0 options:0 animations:^{
self.navigationController.navigationBar.alpha = 0.0;
CGFloat navigationBarHeight = self.navigationController.navigationBar.frame.size.height;
CGRect frame = self.view.frame;
frame.origin.y -= navigationBarHeight;
frame.size.height += navigationBarHeight;
self.view.frame = frame;
} completion:NULL];