In general my app works only in portrait, but one screen should be only in landscape. So I need to rotate my view, hide status bar and add a tool bar. When the status bar is visible my view is rotating fine, but after I perform [[UIApplication sharedApplication] setStatusBarHidden:YES]
, I see no rotation.. Here is the code:
- (void) viewWillAppear:(BOOL)animated
{
//[[UIApplication sharedApplication] setStatusBarHidden:YES];
CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90));
landscapeTransform = CGAffineTransformTranslate (landscapeTransform, +80.0, +100.0);
[self.view setTransform:landscapeTransform];
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.view.autoresizesSubviews = YES;
self.view.bounds = CGRectMake(0.0, 0.0, 480.0, 320.0);
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 20, 480, 40)];
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"BarBg"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 100, 30)];
label.text = @"asdasd";
[toolBar addSubview:label];
[self.view addSubview:toolBar];
self.gallery.backgroundColor = [UIColor redColor];
}