n.evermind
n.evermind

Reputation: 12004

UIFont Sizes: half point sizes possible?

I was wondering why there is no differences between these three:

textView.font = [UIFont fontWithName:f size:10.0];
textView.font = [UIFont fontWithName:f size:10.5];
textView.font = [UIFont fontWithName:f size:10.9];

The font will be shown at 10, no matter what. Will the font size be converted from CGFloat to an integer?

Upvotes: 3

Views: 1046

Answers (1)

TheTiger
TheTiger

Reputation: 13364

I think the font size is being changed but less than 1 increment is very less i.e. our eyes unable to figure it out. You can see it after getting the textView font size. After each increment NSLog the font Size of textView then see what does it print ..

textView.font = [UIFont fontWithName:@"Arial" size:10.0];
float fontSize1 = textView.font.pointSize;
NSLog(@"fontSize1 = %f",fontSize1);

textView.font = [UIFont fontWithName:@"Arial" size:10.5];
float fontSize2 = textView.font.pointSize;
NSLog(@"fontSize2 = %f",fontSize2);

textView.font = [UIFont fontWithName:@"Arial" size:10.9];
float fontSize3 = textView.font.pointSize;
NSLog(@"fontSize3 = %f",fontSize3);

You will get it like this:

fontSize1 = 10.000000

fontSize2 = 10.500000

fontSize3 = 10.900000

Upvotes: 1

Related Questions