Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text view sizing when using custom fonts #305

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

SebastianThiebaud
Copy link

Problem:

Right now, when we use a custom font for the -[FXFormTextViewCell textView] the height isn't right.
+ (CGFloat)heightForField:(FXFormField *)field width:(CGFloat)width is initializing a static UITextView object with [UIFont systemFontOfSize:17]; value for the font property.

Solution:

An easy way to solve that issue is adding a class method that could be override by a subclass.
+ (UITextView *)textViewForSizing is returning a custom UITextView that can be used by the sizing method.
But + (CGFloat)heightForField:(FXFormField *)field width:(CGFloat)width needs to resign its dispatch_once block. The static UITextView object would make useless a subclass override of + (UITextView *)textViewForSizing. This last method is now responsible of the dispatch_once block. For this reason, it would might be clever to update the documentation and ask any developers integrating that feature to be sure to take care of that GCD block for performance reasons.

@markst
Copy link

markst commented Apr 15, 2015

+1

@SebastianThiebaud
Copy link
Author

Would be nice to review that PR. We are still using our fork because the official one isn't supporting that.

@abbasmousavi
Copy link

+1, please review and merge this.

abbasmousavi added a commit to abbasmousavi/FXForms that referenced this pull request Feb 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants