【发布时间】:2014-12-02 02:15:29
【问题描述】:
大家。
伙计们,我的项目中的状态栏有问题..
默认情况下,应用状态栏应该隐藏。这是可行的,但是一个视图有一个像屏幕截图一样的状态栏错误。 在主菜单上它是黑色的并且不隐藏(
在单例中,我正在为不同的设备初始化背景图像,这适用于应用程序中的所有视图))
这是我的代码单例初始化背景:
//后台返回 - (UIColor *)mainBackground:(UIInterfaceOrientation)orientation {
UIColor *color;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundIpad.png"]];
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundLandspIpad.png"]];
}
} else {
color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
}
return color;
}
//return wight screen
- (float)wightScreen {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
return 768;
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
return 1024;
}
}
return wight();
}
//return rect view all for screens
- (CGRect)refreshPoints {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
return CGRectMake(0, 0, 768, 1024);
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
return CGRectMake(0, 0, 1024, 768);
}
} else {
return CGRectMake(0, 0, 320, height());
}
return CGRectMake(0, 0, 768, 1024);
}
这是控制器视图中的代码,我遇到了问题:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
return [[Singleton sharedInstance] getSelf:@"MainMenuController"];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[[PostRequest sharedInstance] userInfo];
self.view.backgroundColor = [[Singleton sharedInstance] mainBackground:[[UIApplication sharedApplication] statusBarOrientation]];
// if (iphone4()) {
// [self newRectNiewIphone];
// }
}
希望能得到你的帮助!
【问题讨论】:
标签: ios objective-c