2014-01-26 2 views
1

스토리 보드에서 드래그 한 탐색 막대 제목 및 글꼴 색상을 변경하고 싶습니다 (팔 컨트롤러에서 자동 생성되지 않음 + 푸시 세그). 이미 시도했습니다.스토리 보드에서 드래그 된 내비게이션 막대의 제목 변경

self.navigationController.topViewController.title = @"title"; 
self.title = @"title"; 
self.navigationItem.title = @"title"; 

그러나 어느 것도 작동하지 않습니다. 제목이 표시되지 않으므로 글꼴이나 색상을 변경하지 않았습니다. 어떻게 수정할 수 있습니까?

답변

1

탐색 표시 줄이 일부 navigationController의 일부인지 확인하십시오. (뷰 컨트롤러가 직접 navig 컨트롤러에 포함되어 있지,하지만 난 모달와 함께이보기에 와서, 그것은하지 먹힐

UILabel* titleLabel = [[UILabel alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 170.0f, 44.0f)]; 

    titleLabel.backgroundColor = [UIColor clearColor]; 
    titleLabel.textAlignment = NSTextAlignmentCenter; 
    titleLabel.textColor  = [UIColor colorWithRed: 0.922f green: 0.925f blue: 0.973f alpha: 1.0f]; 
    titleLabel.font   = [Utils helveticaBoldFontOfSize: 19.333f]; 
    titleLabel.text   = NSLocalizedString(@"Title Here", nil); 
    self.navigationItem.titleView = titleLabel; 
+0

을 : 다른

self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; [self.navigationController.navigationBar setBackgroundImage: [UIImage imageNamed:@"NavBarColor"] forBarMetrics: UIBarMetricsDefault]; self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; self.title = @"Title here!"; 

또는를 :

이 시도 탐색 컨트롤러와 함께보기에서 segue, 이것이 문제가 될 수 있습니까? – r4id4

관련 문제