xaviermerino / XMSegmentedControl

A customizable segmented control with Icons, Text or Icons + Text segments. It is fully customizable and supports several inbuilt styles for displaying the selected segment. Written in Swift for iOS.
MIT License
193 stars 61 forks source link

XMSegmentedControl fails to update auto layout status #3

Closed pigeon-archive closed 8 years ago

pigeon-archive commented 8 years ago

I am using two separate instances of XMSegmentedControl in different Storyboard files and there is an error that I can't seem to get rid of.

Failed to update auto layout status: The agent raised a "CALayerInvalidGeometry" 
exception: CALayer position contains NaN: [nan 25]

If you've found it, I'm confirming more than one person is experiencing it. If not, I'll spend the time to isolate it into its own project and upload it to here.

Cheers. :dancer:

xaviermerino commented 8 years ago

I will take a look and see if i can replicate the problem.

xaviermerino commented 8 years ago

Are you using Auto-Layout constraints?

pigeon-archive commented 8 years ago

Yes.

nahouto commented 8 years ago

Same problem here, I just dropped the view and set its class as XMSegmentedControl and bam ! Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 64]'

nahouto commented 8 years ago

Hi, I just create a new project, dropped a view and set its class as XMSegmentedControl, without any Autolayout constraint, and it gives me the same error : 2015-12-29 09:54:34.698 myProject[1723:972257] * Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 64]' * First throw call stack: (0x1838a1900 0x182f0ff80 0x1838a1848 0x185f95800 0x185f9575c 0x185f956f4 0x18858bbe8 0x1885961c0 0x188595ce8 0x1000997c0 0x100098604 0x1000981a0 0x10009505c 0x100094d94 0x100094dc8 0x18858f778 0x185f9eb2c 0x185f99738 0x185f995f8 0x185f98c94 0x185f989dc 0x185f920cc 0x183858588 0x18385632c 0x1837856a0 0x188602580 0x1885fcd90 0x100090770 0x1833268b8) libc++abi.dylib: terminating with uncaught exception of type NSException

xaviermerino commented 8 years ago

Hey guys I cannot replicate the error. But there is something wrong for sure. Someone should send me a project so i can see whats going on.

ostapkuzyk commented 8 years ago

Hello! The problem is with 0 division inside update() method. I've created the pull request with fix proposal.

xaviermerino commented 8 years ago

Hey guys, I already merged ostapkuzyk pull request. I hope that fixes it. I will look into it when i get back home. Let me know if its working for you guys so I can close this issue.

pigeon-archive commented 8 years ago

Fixed it for me.

DimDL commented 8 years ago

Fixed it for me too. May be it's worth a 0.1.5 release ? Meanwhile, for other reading this, you can use this in your PodFile: pod 'XMSegmentedControl', :head # :head contains a fix for https://github.com/xaviermerino/XMSegmentedControl/issues/3

marialucrecia-ibaldi commented 8 years ago

How do you fix this issue? I have the same problem when I use the storyboard. However, If I create the segmented control programatically, I don't have this issue. Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 0]'

dbburgess commented 8 years ago

@lucreibaldi This should be fixed on the master branch. There just hasn't been a new build released since it was fixed. Try using the master branch instead of a normal release.

p-rothen commented 7 years ago

For cocoapods 1.2.0.beta.1 pod 'XMSegmentedControl', :git => 'https://github.com/xaviermerino/XMSegmentedControl'

Requires Swift 3.0