大家。
伙计们,我的项目状态栏有问题..
默认情况下,应在应用状态栏中隐藏。这是工作,但一个视图有状态栏的错误,如截图。 在主菜单上,它有黑色,不隐藏(
在单身我是初始化不同设备的背景图像,这适用于app中的所有视图))
这是我的代码singleton init background:
//后台返回 - (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];
// }
}
我希望得到你的帮助!
答案 0 :(得分:0)
答案 1 :(得分:0)
您需要设置
self.automaticallyAdjustsScrollViewInsets=NO;
在viewDidLoad方法中的viewController上。