nicklockwood / iCarousel

A simple, highly customisable, data-driven 3D carousel for iOS and Mac OS
http://www.charcoaldesign.co.uk/source/cocoa#icarousel
Other
12.01k stars 2.58k forks source link

SDK 6 and Storyboard Autolayout #262

Open thiagorios opened 12 years ago

thiagorios commented 12 years ago

Hi all.

I'm developing a universal application and using the iCarousel. The application was running. When I changed the application for the SDK 6, I had the following problem:

'Auto Layout still required after executing -layoutSubviews. iCarousel implementation of -layoutSubviews needs to call super.'

By adding the code in iCarousel.m file:

The application does not open, creating a kind of loop.

The problem happen only when I change my Storyboard to 'Use Autolayout'.

You guys know the solution?

Thanks in advance

nicklockwood commented 12 years ago

I'm not able to replicate this problem in the storyboard demo app included with iCarousel. Are you using ARC?

thiagorios commented 12 years ago

Hi Nick.

No, I'm not using ARC.

I tested the demo "Storyboard Demo" and it worked. In my project identified who had views within iCarousel. These views cause the problem.

Removing these subviews my project worked.

Can you check when adding subviews in Carousel?

Thanks

JDeokule commented 11 years ago

Calling [super layoutSubviews] puts it into an infinite loop between layoutSubviews and resizeSubviews

I am using ARC and got these errors:

*** Assertion failure in -[iCarousel layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView.m:5776
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. iCarousel's implementation of -layoutSubviews needs to call super.'
JDeokule commented 11 years ago

On second look, this seems like an error on my part.

I had a UItoolbar floating above the carousel. I thought that they were both subviews of the main view. However my toolbar was a subview of the carousel view itself. This caused the carousel to throw the error.

From this error, it seems safe to say that iCarousel can't support subviews at this point - at least for subviews added in the Storyboard when Auto Layout is on

danilobuerger commented 10 years ago

Was able to replicate this in 1.7.6. Issue has been resolved in master by https://github.com/nicklockwood/iCarousel/commit/687642eabcfcd67b8d33382afd5b5246cfe08ccb