简体   繁体   中英

Font issue in setting in UILabel iOS

I am using custom fonts in my iOS App. Two of the fonts named quicksand_bold.ttf and quicksand_book.ttf are causing issue. All of the other fonts are working perfectly fine but this QuickSand font is not appearing as the two different types in the fonts,

在此处输入图片说明

neither is is showing different styles

在此处输入图片说明

both the files have been imported properly and the target is also set for them. Also the names of the fonts are added in the info.plist. Can anyone point out something I am missing or something I should do to get them both work. All the other fonts are working perfectly fine as they should.

UPDATE

Here are the screenshots of the info.plist and the font names from the projects 在此处输入图片说明

在此处输入图片说明

By getting a hint from @sneha's comment, I checked the names of these two fonts, both were the same. I installed the fonts in my MacBook rather then importing them to my project, restarted my xcode then i found these two in the storyboard with the same name and two different styles (Book and Bold). For using these fonts programmatically i used NSLog to figure out the names of the font and the names are QuicksandBook-Regular and QuicksandBold-Regular . So you can programmatically set these as

myLabel.font = [UIFont fontWithName:@"QuicksandBook-Regular" size:12.0];

and

myLabel.font = [UIFont fontWithName:@"QuicksandBold-Regular" size:12.0];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM