나는 애플 대리자에서 다음과 같이 내 탐색 모음 수정 :제거 uinavigationbar 제목 마진
NSDictionary *settings = @{
UITextAttributeFont : [UIFont fontWithName:@"impact" size:36.0],
UITextAttributeTextColor : [UIColor whiteColor],
UITextAttributeTextShadowColor : [UIColor clearColor],
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetZero]};
[[UINavigationBar appearance] setTitleTextAttributes:settings];
을하지만 글꼴은 큰 글꼴이 같이 아래로 잘라냅니다. :
나는, 내 VC의 viewWillAppear에서이 일을 시도 :
UIView *newTitleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
[newTitleView setBackgroundColor:[UIColor blackColor]];
[self.navigationController.navigationBar addSubview:newTitleView];
그럼 내가 중심에 제목을 정렬하려고 했어요. 그러나 그것은 단지 옳은 것처럼 보입니다. 실제로 필요한 것은 제목 라벨의 상단과 하단에서 여백을 제거하는 것입니다. 어떻게해야합니까?
initWithFrame : CGRectZero ?? – CalZone
유연한 너비를 제공해야합니다 ... 작동하지 않는 경우 [[UILabel alloc] initWithFrame : CGRectMake ([self.title length] <10? UITextAlignmentCenter : UITextAlignmentLeft), 0, 480,44) ]; titleLabel.backgroundColor = [UIColor clearColor]; – Divyu
'self.navigationController.navigationItem.titleView = titleView;'어떻게 든 나를 위해 일하지 않습니다, 나는 [self.navigationController.navigationBar addSubview : titleView]; '를 사용했습니다. – CalZone