아이폰 프로그래밍 방식으로 서체 설정을 글꼴색 유아벨 - 에서 -

나는 내 다음과 같은 코드를 실행한다.

tmp=[[UILabel alloc] initWithFrame:label1Frame];
tmp.tag=1;
tmp.textColor=[UIColor blackColor];
[tmp setFont:[UIFont fontWithName:@"American Typewriter" size:18]];
tmp.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:tmp];
[tmp release];

Now, I need to know),

= &gt. &quot 설정하는 방법, 서체 = bold&quot. 코드를 통해?

질문에 대한 의견 (3)
해결책

'패밀리 내의 굵은꼴' 글꼴색 이름을 사용해야 합니다. 알아보기 위해 미국 버전의 경우 '입력, 출력 시도하시겠습니까 굵은꼴'

[UIFont fontNamesForFamilyName:@"AmericanTypewriter"] 

이 콘솔이군요.

이 경우, AmericanTypewriter-Bold&quot &quot 콩지름에 ','.

[UIFont fontNamesForFamilyName:@"AmericanTypewriter-Bold"] 
해설 (5)

어떤 세터 사용에 대한 속성:

// Create a string  
NSString *text = @"You are getting sleepy.";

// Get a font to draw it in  
UIFont *font = [UIFont boldSystemFontOfSize:28];

// Draw the string  
[text drawInRect:(CGRect)
withFont:font];
해설 (1)

그냥 산로그 글꼴 운영까지도 프레젠테이션이든:

NSLog(@" %@", [UIFont fontNamesForFamilyName:@"American Typewriter"]);

및 확보하십시오 어레이입니다:

(
    "AmericanTypewriter-CondensedLight",
    "AmericanTypewriter-Light",
    "AmericanTypewriter-Bold",
    AmericanTypewriter,
    "AmericanTypewriter-CondensedBold",
    "AmericanTypewriter-Condensed"
)

필요한 사용하여 코드:

UILabel * loading = [[UILabel alloc] initWithFrame:CGRectMake(350, 402, 150, 25)];
    [loading setFont:[UIFont fontWithName:@"AmericanTypewriter-Bold" size:12.0]];
    [loading setTextColor:[UIColor whiteColor]];
    [loading setBackgroundColor:[UIColor clearColor]];
    [loading setText:@"Loading ..."];
    [self.view addSubview:loading];
해설 (0)

모든 iOS 에서 얻을 수 있으며, 이 사이트에 글꼴 이름 리오스폰츠. 미리본 시행하십시오 고객의 정확한 답을 찾기 위해 문자열이어야 가장 위에 언급된 글꼴과 같이 사용한다.

UILabel * myLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 400, 150, 50)];
    [loading setFont:[UIFont fontWithName:@"Avenir-Black" size:12.0]];
    [loading setTextColor:[UIColor redColor]];
    [loading setBackgroundColor:[UIColor clearColor]];
    [loading setText:@"My Label Title"];
    [self.view myLabel];
해설 (0)

@Devinfoley 작성했습니까 굵은체의 '을' 같은 추가해야 합니다 ',' # 39 폰타나미 you& re 사용 중. # 39 '대신' t it for me, doesn& 작동합니까 폰타나미스포르파밀리나미 I& # 39 m ',' 폰트위스나미 크기 사용하여. 아마 작동하잖아 생성하면 유아벨 '' 프로그램을 통해. 저의 경우는 '설정' m just 글꼴색 I& # 39, 내 안에 있다 '와' 이 '에서' 유아벨 확장명은 웨이크프롬니브 설정되었습니다 '클래스' 를 '' 내 아이디 검사자를 확장명은 유아벨 특정 ''. '와' '내' 와 '퐁시즈 셀프리폰t.푸아나시즈 설정할 수 있습니다' 인터페이스입니다 구성기는 돌봐줄꺼야 경우 더 나은 UI 요소.

- (void)awakeFromNib{

    [super awakeFromNib];
    [self setAdjustsFontSizeToFitWidth:YES];
    [self setFont:[UIFont fontWithName:@"Font-Bold" size:self.font.pointSize]];
}

'모든', '글꼴색 경우 doesn& # 39 의 t 작동합니까 인쇄하십시오 글꼴에서처럼 합니다', '잘못된' 폰타나미 경우 가족요 볼 수 있도록 글을 썼다. 또한 이 방법을 사용할 수 없는 경우 확인할 수 있다 '는' 글꼴색 굵은꼴 경우, 이 옵션을 인쇄했습니다 너회가 don& # 39 없다.

NSLog (@"Available Fonts: %@", [UIFont fontNamesForFamilyName:@"Your Font"]);

'보다' 글꼴색 얘기입니다. https://stackoverflow.com/a/8529661/1141395

해설 (0)
  • 빠른 업데이트 *

39, ve you& 경우 이미 추가했어야 글꼴색 애플리케이션 (대로 here), '예' 기능을 사용할 수 있습니다, a 's # 39 Swift& 확장명은 로보토 글꼴과 유아벨' 과 함께:

extension UILabel {

    func setFont(style: String, size: Int){
        self.font = UIFont(name: style, size: CGFloat(size))
    }

    struct FontStyle {
        public static let italic: String = "Roboto-LightItalic"
        public static let normal: String = "Roboto-Light"
        public static let thin: String = "Roboto-Thin"
    }
}

39 의 '는' Roboto-LightItalic '와' 로보토 표시등으로 ttf& 글꼴색 파일 이름. 그런 다음 호츨 됩니다

someUILabel.setFont(style: UILabel.FontStyle.normal, size: 20)
해설 (0)