문제

Dead Imageshack 링크를 제거했습니다

보시다시피 변경해야 할보기는 Tabbar 순서를 사용자 정의하기 위해 제공된보기입니다. 내비게이션 막대의 색상을 변경하고 싶습니다 ( "구성"을 의미하는 "Konfigurieren"표시)는 이미 "More"-Navigation 컨트롤러의 색상을 변경하는 방법을 이미 알게되었습니다. 아무도 저를 도와 줄 수 있습니까?

도움이 되었습니까?

해결책

int appdelegate를 사용하십시오

tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor blackColor];

다른 팁

나는 당신이 찾고있는 것이 이것이라고 생각합니다 (일반적으로 앱 대의원에서 내비게이션 컨트롤러를 만들 때해야합니다).

UINavigationController *navigationController;
...
navigationController.navigationBar.tintColor = [UIColor blackColor];

반드시 작동 할 것입니다! :-)

self.navigationController.navigationBar.tintColor  = [UIColor blackColor];

더 쉬울 수 있습니다 (탭 바 대의원에서 사용) :

- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers {
id modalViewCtrl = [[[tabBarController view] subviews] objectAtIndex:1];  
if([modalViewCtrl isKindOfClass:NSClassFromString(@"UITabBarCustomizeView")] == YES)
    ((UINavigationBar*)[[modalViewCtrl subviews] objectAtIndex:0]).tintColor = [UIColor redColor];
}

각각의 내비게이션 막대 스타일을 개별적으로 변경하는 대신 모든 내비게이션 막대 스타일을 변경하는 쉬운 방법이 있습니다.

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlack];

이 코드를 초기보기 중 하나로 설정하십시오. 이를 통해 더 많은 내비게이션 컨트롤러와 구성 탐색 컨트롤러 (더 많은 탐색 컨트롤러에서 "편집"을 클릭 한 후 나타남)는 다른 스타일을 얻습니다.

이와 같이 색상을 다른 색상으로 변경하거나 배경 이미지를 변경할 수 있습니다.

도움이 되었기를 바랍니다.

다음과 같이 구성 네이브 바의 색상을 변경할 수있었습니다.

  1. UitabbarController에서 상속되는 새로운 클래스를 만듭니다.
  2. 이 방법을 구현하십시오.

    -(void)beginCustomizingTabBar:(id)sender
    {
        [super beginCustomizingTabBar:sender];
    
        // Get the new view inserted by the method called above
        id modalViewCtrl = [[[self view] subviews] objectAtIndex:1];
    
        if([modalViewCtrl isKindOfClass:NSClassFromString(@"UITabBarCustomizeView")] == YES)
        {
            UINavigationBar* navBar = [[modalViewCtrl subviews] objectAtIndex:0];
    
            [navBar setBarStyle:UIBarStyleBlackTranslucent];
            [navBar setTranslucent:YES];
        }
    }
    

user486217이 제공 한 답변을 구축하면 더 방어 적으로 코딩 될 수 있습니다.

id modalViewCtrl = [controller.view.subviews objectAtIndex:1];  
if([modalViewCtrl isKindOfClass:NSClassFromStrin(@"UITabBarCustomizeView")] == YES) {
    id navigationBar = [[modalViewCtrl subviews] objectAtIndex:0];
    if ([navigationBar isKindOfClass:[UINavigationBar class]]) {
        ((UINavigationBar*)navigationBar).tintColor = [UIColor redColor];
    }
}}

표준 색상 (회색, 검은 색, 흰색)을 찾고 있다면 Xcode 5 내에서 이러한 값을 설정할 수 있습니다. 전체보기 컨트롤러를 선택하고 속성 검사관을 선택하십시오. 속성에서 "상단 막대"옆에 드롭 다운이 있습니다. 여기에서 내비게이션 바 컨트롤러의 색상 및 불투명도에 대한 다양한 설정을 선택할 수 있습니다.

아래에는 몇 가지 스크린 샷이 요약되어 있습니다. 도움이 되었기를 바랍니다!

enter image description here

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top