답변:
뷰 컨트롤러의 .h 파일에 속성을 추가합니다.
@property (nonatomic, retain) IBOutlet UILabel *label;
Interface Builder의 "File 's Owner"아울렛에서이 IBOutlet에 레이블을 연결합니다. ARC를 사용하지 않는 경우 -dealloc에서 해제해야합니다.
- (void)dealloc
{
[self.label release];
[super dealloc];
}
그런 다음 글꼴 이름과 크기를 얻으려면
NSString *fontName = self.label.font.fontName;
CGFloat fontSize = self.label.font.pointSize;
빠른:
var currentFontSize = button.titleLabel?.font.pointSize
Pointsize 값은 UIFont 크기 속성에 사용 된 글꼴 크기가 아닙니다. 인터페이스 빌더 글꼴 크기를 14로 설정하고 pointSize를 인쇄하면 11 개만 표시됩니다.
myLabel.font.pointSize반환합니다.