黑色状态栏bug iOS
大家好 伙计们,我的项目中的状态栏有问题 默认情况下,应隐藏应用程序内状态栏。这是工作,但有一个视图有一个与屏幕截图一样的状态栏错误。 在主菜单上,它是黑色的,不隐藏( 在singleton中,我正在初始化不同设备的背景图像,这适用于应用程序中的所有视图。) 这是我的代码singleton init后台: //背景回波 -(UIColor*)主背景:(UIInterfaceOrientation)方向{黑色状态栏bug iOS,ios,objective-c,Ios,Objective C,大家好 伙计们,我的项目中的状态栏有问题 默认情况下,应隐藏应用程序内状态栏。这是工作,但有一个视图有一个与屏幕截图一样的状态栏错误。 在主菜单上,它是黑色的,不隐藏( 在singleton中,我正在初始化不同设备的背景图像,这适用于应用程序中的所有视图。) 这是我的代码singleton init后台: //背景回波 -(UIColor*)主背景:(UIInterfaceOrientation)方向{ UIColor *color; if (UI_USER_INTERFACE_
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];
// }
}
我希望你的帮助!这是错误状态栏的截图 和截图,如何在另一个视图 您需要设置
self.automaticallyAdjustsScrollViewInsets=NO;
在viewDidLoad方法中的viewController上