This is my final implementation for the control thanks to Tommy's hint:
BOOL controlsWereShown=YES;
-(void)toggleControls{
UIWindow *statusBarWindow = (UIWindow *)[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
CGRect frame=CGRectZero;
if([statusBarWindow isKindOfClass:[UIWindow class]]){
frame= statusBarWindow.frame;
if(frame.origin.y < 0){
frame.origin.y = 0;
}
else{
frame.origin.y = -85;
}
}
[UIView animateWithDuration:.8 animations:^{
self.barConstraint.constant=(controlsWereShown?-85:19);
self.bottomConstraint.constant=(controlsWereShown?50:0);
self.renewalViewConstraint.constant=(controlsWereShown?-120:0);
controlsWereShown=!controlsWereShown;
if (frame.size.width != 0) statusBarWindow.frame = frame;
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate) withObject:nil];
[self.view layoutIfNeeded];
}
completion :^(BOOL finished){
}
];
}
The only problem in that solution is that the status bar slides together with the top bar instead of remaining attached on the top of it while sliding. I sort of fixed it by setting the end origin at -85 instead of -20, so to follow the bar while sliding.