I created a UITextView with a font size of 14 in a storyboard and hooked it up to the detailDescriptionLabel property of my ViewController. This code is in viewDidLoad:
self.detailDescriptionLabel.font=[UIFont systemFontOfSize:10];
NSLog(@"text is %@; font is %@", self.detailDescriptionLabel.text, self.detailDescriptionLabel.font);
The console output follows:
text is Lorem Ipsum; font is (null)
Why is the font set to nil? The setFont: is working; the font does shrink. I want to get the font so after a gesture I can call lineHeight on the font. This way, I can find out which line has been tapped with the following code:
int line = [tap locationInView:tap.view].y / self.detailDescriptionLabel.font.lineHeight;
Here, too, the font is nil. line is set to -2147483648, which is obviously not what I want.