0

I have created a CococoaPod framework for common UI to be used inside multiple projects. I have assigned Source Sans Pro to UILabels in the storyboard and Font files are added to the CocoaPod framework inside the resource folder.

When any app using this framework runs in the simulator, instead of Source Sans Pro font, labels are showing Helvetica font.

If I apply font property explicitly in viewDidLoad to UILabel for which Source Sans Pro was set in Storyboard but Helvetica was showing, Source Sans Pro font is shown.

I want to know why appropriate fonts are not showing up from UIStoryboard file coming from Pod framework.

1 Answer 1

-1

You can set the font property of UILabel in storyboard and as well as in code. It depends on how you set your font. If you are trying to set the different font in code than the one which you already set in Storyboard, It will take the font that you set in Code. 


Assume you set the Sans Pro to Label in storyboard and you are trying to set different font Helvetica in viewDidLoad means, it will take the Helvetica only.

It will be good if you consistently follow in any one manner, either in Storyboard or in the Code. 
And you can set the attributes of UILabel in it's didSet property observer


@IBOutlet weak var myLabel: UILabel! { didSet { myLabel.font = UIFont.systemFont(ofSize: 20) // you can set your custom font as well myLabel.textColor = UIColor.white } } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.