2013-09-26 58 views

回答

37

如果你只是喜歡動態字體大小與自己的字體,你可以做到這一點

UIFontDescriptor *userFont = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleBody]; 
float userFontSize = [userFont pointSize]; 
UIFont *font = [UIFont fontWithName:@"ArialHebrew-Bold" size:userFontSize]; 
+0

真棒夥計..謝謝 – shyamsundar1988

5

斯威夫特的版本:

let systemDynamicFontDescriptor = UIFontDescriptor.preferredFontDescriptorWithTextStyle(UIFontTextStyleBody) 
let size = systemDynamicFontDescriptor.pointSize 
let font = UIFont(name: "ArialHebrew-Bold", size: size) 
1

開始與iOS 11:

let bodyMetrics = UIFontMetrics(forTextStyle: .body) 
let standardFont = ... // any font you want, for standard type size 
let font = bodyMetrics.scaledFont(for: standardFont)