나는 다음과 같은 코드를 사용하여 UILabel의를 사용하여 경고 배지를 만드는 오전 :System UIFont에 대해 ascender 또는 descender를 설정할 수 있습니까?
[label setText:@"67"];
UIFont * font = [UIFont systemFontOfSize:11];
[label setFont:font];
[label sizeToFit];
[label setTextAlignment:NSTextAlignmentCenter];
[label setBackgroundColor:[UIColor yellowColor]];
[label setTextColor:[UIColor whiteColor]];
label.layer.cornerRadius = label.frame.size.height/2;
모든 텍스트의 미세하지만 수직 정렬이 정확하지입니다. 그것의 상단에 더 가깝다. UILabel의 수직 가운데에 텍스트를 정렬하려면 어떻게해야합니까?
UIFont의 상감 특성과 하강 속성을 읽었을 때 UILabel의 세로 중심에 텍스트를 정렬하는 데 사용할 수 있습니까?
네, 효과가있었습니다! 고마워요 @ Cyrille! –