lexrus / LTMorphingLabel

[EXPERIMENTAL] Graceful morphing effects for UILabel written in Swift.
MIT License
8.07k stars 782 forks source link

Text alignment is strange on IOS 8 #8

Closed skware closed 9 years ago

skware commented 10 years ago

Hi,

Congrats for this label, it's very cool. I have a problem. Everything displays properly centered on IOS 7 but is offsetted to the right on iOS 8 . Do you have an idea?

Thanks

lexrus commented 10 years ago

I'm sorry I do not have any iOS 8 device. But it's fine in simulator. The alignment is implemented in https://github.com/lexrus/LTMorphingLabel/blob/master/LTMorphingLabel/LTMorphingLabel.swift#L235-L242 . Did I miss something?

lexrus commented 10 years ago

@skware I've tested it on my iPhone 5s on iOS 8 GM and the text alignment looks okay.

skware commented 10 years ago

Hi,

I have done some more testing. Using your test project there is no alignement problem because your view controller in the storyboard is already at the proper screen size.

I experience the problem because i am using size classes in my storyboard which mean the view controller in the storyboard is a square bigger than the final display size.

I think some alignment size are calculated BEFORE the screen is resized by auto layout and the label at this moment is larger than the final size that will be displayed.

so: setting the text in the storyboard or in the viewDidLoad methods leads to alignement problem. Setting the text in the viewWillAppear or any text change after that is correct.

I can give you a project that demonstrates the problem.

Beside that LTMorhpingLabel is an amazing label!

lexrus commented 10 years ago

Oh, I forgot to test it with SizeClass and AutoLayout. @skware Thank you.

skware commented 10 years ago

no problem. I think the problem is more related to resizing in general than size classes only. Tell me if i can help

lexrus commented 9 years ago

@skware I've activated Size Class and Auto Layout in the demo. https://github.com/lexrus/LTMorphingLabel/commit/dedfaa673054e371e017a85c1f340c840d3d1ce5

And set a new text in viewDidLoad: https://github.com/lexrus/LTMorphingLabel/commit/b65a386422b6b261ae40500d921170c5f481638e#diff-7825dcc6b9f4ca74445235a9997d0e37R31 It seems like the alignment is okay.

Could you please try the latest code.

skware commented 9 years ago

Hi, Just tested here and alignment works as expected when the text is set in viewDidLoad. Thanks for fixing it!

lexrus commented 9 years ago

@skware :+1: