2015-01-27 5 views
2

상태 표시 줄을 반투명하게 만드는 데 도움이 필요합니다. 앱의 일부 부분에서는 잘 작동하고 다른 부분에서는 제대로 작동하지 않습니다.상태 표시 줄을 반투명하게 만드는 방법은 무엇입니까?

Status bar black

이 내가 navugation 표시 줄을 표시하는 경우 상태 표시 줄이오고 방법이다.

status bar translucent

이 난 탐색 줄을 제거 할 때 표시되는 방법이다. 탐색 표시 줄을 표시해야하지만 상태 표시 줄은 반투명해야합니다. 배경 이미지는 탐색 모음과 함께 푸시 다운됩니다. 프로그래밍 방식으로 기본 클래스를 만드는 배경 이미지를 설정했습니다.

-(void)addBackGroundImage{ 

self.backGroundImage=[[UIImageView alloc] init]; 
self.backGroundImage.translatesAutoresizingMaskIntoConstraints=NO; 
[self.backGroundImage setImage:[UIImage imageNamed:@"background"]]; 
self.backGroundImage.contentMode=UIViewContentModeScaleAspectFill; 
[self.view addSubview:self.backGroundImage]; 

[self.view sendSubviewToBack:self.backGroundImage]; 
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[_backGroundImage]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_backGroundImage)]]; 
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(0)-[_backGroundImage]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_backGroundImage)]]; 

AppDelegate *objAppDelegate=[[UIApplication sharedApplication] delegate]; 
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, 20)]; 
view.backgroundColor=[UIColor clearColor]; 
[view setAlpha:0.2]; 
} 

-(void)updateBackgroundImage:(UIImage *)bgImage{ 

[self.backGroundImage setImage:bgImage]; 
} 

답변

1

그것은 당신이 완전히 기본 헤더 배경 (상태 표시 줄 + 내비게이션 바)를 제거하고 설정하는 데 필요한 실제로 자신 : 내가 보여주고 싶은 탐색 모음에 이미지가

// ViewController.m 

self.navigationController.navigationBar.backgroundColor = [UIColor clearColor]; 
self.navigationController.navigationBar.tintColor = [UIColor yourColor]; // Set your tint color 
self.navigationController.navigationBar.shadowImage = [UIImage new]; 
self.navigationController.navigationBar.translucent = YES; 
self.navigationController.navigationBar.opaque = NO; 
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; 
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 64)]; 
bgView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Your_Background_Image"]]; 
[self.view addSubview:bgView]; 
+0

. 그 이미지는 네비게이션 바를 포함하고 상태 표시 줄은 다루지 않습니다. 내 질문이 명확하지 않으면 미안 해요. –

+0

업데이트 된 답변보기 - 잘 작동합니다. – Lyanch

+0

Me는 네비게이션 요소의 색조를 적절하게 설정하기위한 답을 다시 업데이트했습니다. – Lyanch

관련 문제