rsattar / CLTokenInputView

A replica of iOS's native contact bubbles UI
MIT License
504 stars 127 forks source link

`fieldLabel` Font Size Issue #10

Closed mliberatore closed 8 years ago

mliberatore commented 8 years ago

I'm attempting to find a good solution for customizing the font of the fieldName label (fieldLabel). With https://github.com/clusterinc/CLTokenInputView/issues/9 implemented (thank you), I'm able to customize the font of the tokens and input text as follows:

[UITextField appearanceWhenContainedIn:[CLTokenInputView class], nil].font = [UIFont italicSystemFontOfSize:20];

I hoped to be able to do the same for the label using the following:

[UILabel appearanceWhenContainedIn:[CLTokenInputView class], nil].font = [UIFont italicSystemFontOfSize:20];

But this produces the following results in your sample application (notice the truncated labels):

simulator screen shot oct 21 2015 6 22 58 pm

I've added those two lines to the beginning of -viewDidLoad in CLTokenInputViewController.m.

I've added a temporary work around to my app by setting fieldName to nil and back to it's intended value on the next run loop cycle inside of [[NSOperationQueue mainQueue] addOperationWithBlock:...], but this solution is less than ideal, and leads to further layout issues with the text insertion point after rotating the interface.

Do you have any recommendations for a solution or a fix in mind? I'd like to support dynamic type, and allow the field label to grow and shrink like the tokens and input text.

Also, thank you very much for the hard work on CLTokenInputView!

rsattar commented 8 years ago

Hey @mliberatore, you should be able to manipulate the fieldLabel using UIAppearance now, in 2.3.0. Thanks for filing the issue :100:

mliberatore commented 8 years ago

Thank you, @rsattar! :smiley: