GithubHelp home page GithubHelp logo

Comments (5)

nicklockwood avatar nicklockwood commented on May 24, 2024

Are you using the carouselItemWidth delegate method, and if so are you also updating the value returned by this method when you rotate the screen?

Nick

(Sent from my iPhone)

On 20 Jul 2011, at 15:40, rpitting [email protected] wrote:

I am not sure if I'm missing something or it's a feature not implemented:

I have a carousel that uses two different item-sizes for portrait and landscape, with the langscape size being smaller.

Therefore, all items shrink in landscape mode. At the moment I call layoutSubviews and reloadData and in didRotateFromInterfaceOrientation.

Unfortunately, this leads to gaps between the items when rotating the device from portrait to landscape, as the subviews do not seem to be rearranged with the new item size (their anchor point just stays where it was).

So does the component not yet support a variable item size? And if it does, what's the right order of calling layoutSubviews etc.?

Or is the (animated) change of the item size currently not possible?

Reply to this email directly or view it on GitHub:
https://github.com/demosthenese/iCarousel/issues/18

from icarousel.

rpitting avatar rpitting commented on May 24, 2024

Yes, actually returning two different values in the delegate method carouselItemWidth will work, sorry for this error in my description.

To apply the new size, call reloadData.

Although, the items are not not animated between their two sizes, they jump. But, I admit, animating the size is quite a custom request.

I guess the best way to do this is to get the visible views via iCarousel.visibleViews and animate their centers yourself.

Or is there a smarter way?

from icarousel.

nicklockwood avatar nicklockwood commented on May 24, 2024

This seems like an oversight on my part. I'll see what's involved in adding this feature.

Nick

(Sent from my iPhone)

On 21 Jul 2011, at 09:30, rpitting [email protected] wrote:

Yes, actually returning two different values in the delegate method carouselItemWidth will work, sorry for this error in my description.

To apply the new size, call reloadData.

Although, the items are not not animated between their two sizes, they jump. But, I admit, animating the size is quite a custom request.

I guess the best way to do this is to get the visible views via iCarousel.visibleViews and animate their centers yourself.

Or is there a smarter way?

Reply to this email directly or view it on GitHub:
https://github.com/demosthenese/iCarousel/issues/18#issuecomment-1622121

from icarousel.

nicklockwood avatar nicklockwood commented on May 24, 2024

I'm having trouble reproducing this issue. It seems to work as expected if you simply call reloadData on didRotateFromInterfaceOrientation and then return views of a different size from your viewForItemAtIndex method. Calling layoutSubviews explicitly shouldn't be necessary, so maybe by calling it you are somehow preventing the layout from working correctly?

If you still can't get it working, post the code you are using and I'll investigate further.

from icarousel.

nicklockwood avatar nicklockwood commented on May 24, 2024

Actually, I may have misunderstood what you are trying to do. Are you using the view autoresizingmask to scale your views automatically in response to the screen rotation?

If so, there's a fork here that tweaks the autoresizingmask of the container views so they scale automatically:

https://github.com/veritech/iCarousel

If that solves your problem I might look at rolling it into the main branch.

from icarousel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.