If you are using iOS 3, you need to use the leading property:
int numLines = txtview.contentSize.height / txtview.font.leading;
If you are using iOS 4, you need to use the lineHeight property:
int numLines = txtview.contentSize.height / txtview.font.lineHeight;
And, as @thomas noted, be careful when rounding if you need an accurate result.
Evan mulawski
source share