problame / CSNotificationView

Drop-in, semi-translucent and blurring notification view.
MIT License
900 stars 152 forks source link

iOS 6 Compatibility #30

Closed bcylin closed 10 years ago

bcylin commented 10 years ago

This is probably just a temporary adjustment since most apps might drop support for iOS 6 by the end of this year. So I merely altered some iOS-7-only methods instead of making changes to the UIToolbar layers mentioned in #29.

Unfortunately, UILabel adjustsFontSizeToFitWidth doesn't work well in iOS 6.

In iOS 6 and earlier, this property is effective only when the numberOfLines property is set to 1.

But I think that won't cause too much trouble.

img_3820

problame commented 10 years ago

I'll have a look at the code in the following days, but right now, I'm just too busy. But thanks again for your contribution!

bcylin commented 10 years ago

No problem, take your time!

problame commented 10 years ago

I have cherry-picked some of your code and added some stuff myself. Multiline now works on iOS 6 although adjustsFontSizeToFitWidth still doesn't. Check out master at fe76662f749812059094717bd23795f2f5a8b49a and see if it works ;)

bcylin commented 10 years ago

master works all right! :+1: The way to achieve multiline-label in 182c70a80ba6734ef13695cacc91dc7056c5b504 is much better than adding an additional hight constraint on textLabel.

So this pull request should be okay to close?

problame commented 10 years ago

I would still prefer some way to get adjustsFontSizeToFitWidth working on iOS 6. I guess one has to implement the shrinking oneself. Something like this although I'm not sure how to get this stuff working with auto layout.

I guess in some post-layout method, the font size for the label has to be calculated again, but only on iOS 6. Could have performance implications, too.

Would you try to implement something that pays attention to all the points mentionend above?

bcylin commented 10 years ago

I replaced the unnecessary commit with your _textLabel configuration cherry-picked, tried to manually resize font when layoutSubviews in iOS 6. Please try it out, thanks!

problame commented 10 years ago

I merged the commit and made some minor changes a9054c5c803a13055a0267d8188c0615f4bb58f1. Please test and check if everything works.

bcylin commented 10 years ago

Everything seems to be working fine. Let's close this!