나는 이것에 관해 여기에 게시 된 모든 답을 시도했다. 그리고 나는 여러 줄을 만들었지 만 지금부터는 약간의 부분부터 시작하는 텍스트가 필요하다. 제목 라벨을 어디에서 시작하길 원하는지 보여주는 스크린 샷을 참조하십시오. 나는 UIView의하지만 여전히 행운과 라벨을 교체 시도iOS 멀티 라인 제목 표시 줄
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0.0, 0.0, [UIScreen mainScreen].bounds.size.width, 44)];
[titleLabel setNumberOfLines:3];
[titleLabel setBackgroundColor:[UIColor darkGrayColor]];
[titleLabel setTextColor:[UIColor whiteColor]];
[titleLabel setFont:[UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:30.0]];
[titleLabel setText:@"LET'S GET YOU REGISTERED"];
self.navigationItem.titleView = titleLabel;
-
여기 내 코드입니다.
내 사용자 지정 탐색 컨트롤러 파일의 코드는 -
@interface UINavigationBar (myNave)
- (CGSize)changeHeight:(CGSize)size;
@end
@implementation UINavigationBar (customNav)
- (CGSize)sizeThatFits:(CGSize)size {
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height * 0.15;
CGSize newSize = CGSizeMake(screenWidth,screenHeight);
return newSize;
}
@end
도와주세요.
비주얼 편집기에서 'titleLabel'을 움직이려 했습니까? – abiessu
텍스트를 단순히 "등록"으로 변경하는 방법. 그건 한 줄에 들어 맞을거야. – Koen
제목 라벨이 IB에 없습니다. 그것은 사용자 정의 탐색 막대를 사용하고 있기 때문에 그것은 프로그래밍 방식으로 추가되어야하고 그 문자열을 바꿀 수 없다. –