Reputation: 11389
I have a storyboard with labels. The label's font is set to System 25.
I wanted to make the font size dynamic, and I set it by code now. I set breakpoints, so I know that "25" is actually chosen in my code, but the font size still is smaller than when I set it in the storyboard designer.
Does anybody perhaps spot where I might have gone wrong or any caveats that I might have missed?
//set label font size
CGFloat nFontSize;
if (bIsIPad)
{
nFontSize=25.0;
}
else if (bIsIPhone_3GS_4_4s_Or_iPodTouch_3_4)
{
nFontSize=12.0;
}
else if (bIsIphone_5_Or_IPodTouch_5)
{
nFontSize=25.0;
}
UIFont *nFont = [UIFont fontWithName:@"System" size:nFontSize];
captionLabel0.font = nFont;
captionLabel1.font = nFont;
Upvotes: 0
Views: 509
Reputation: 11389
It seems that "fontWithName:@"System"" is not the same as "[UIFont systemFontOfSize:nFontSize];"
The storyboard property page seems to reflect "systemFontOfSize" when it displays the font "System".
When I chose "systemFontOfSize", the results were the same as in the storyboard.
Upvotes: 2
Reputation: 33
You need to connect your label to outlet (storyboard).
And after that, you set the font size for this label.
Upvotes: 0