2

In my project I have a iCarousel in one view.Everything working fine for me. But my problem is, I want to keep the first index object at the center of the view when that view gets loaded.Am displaying totally three images in the carousel.Now the first image is loading at the right corner.I want to keep it in center while loading.How can I do this.? please share your ideas.

NSUserDefault
  • 1,794
  • 1
  • 17
  • 38

1 Answers1

3

You can use iCarouselOptionWrap to do this task.. Just implement this delegate

- (CGFloat)carousel:(iCarousel *)_carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
{
    //customize carousel display
    switch (option)
    {
        case iCarouselOptionWrap:
        {
            //normally you would hard-code this to YES or NO
            return YES;
        }
        case iCarouselOptionSpacing:
        {
            //add a bit of spacing between the item views
            return value * 1.05f;
        }
        case iCarouselOptionFadeMax:
        {
            if (carouselForUser.type == iCarouselTypeCustom)
            {
                //set opacity based on distance from camera
                return 0.0f;
            }
            return value;
        }
        default:
        {
            return value;
        }
    }
}
Rajneesh071
  • 30,846
  • 15
  • 61
  • 74
  • Hai, my problem solved when I used the delegate method - (NSUInteger)numberOfPlaceholdersInCarousel:(iCarousel *)carousel with return 0;Thanks for your reply. – NSUserDefault Dec 05 '12 at 06:47
  • Your welcome brother..don't forget to accept answer and +1 for this.. :) – Rajneesh071 Dec 05 '12 at 06:51
  • 0 is the default for numberOfPlaceholders - you should just omit the method completely. – Nick Lockwood Dec 05 '12 at 07:02
  • hi @NickLockwood, i have one question... i am implementing 2 carousel in a view...and adding different different imageView in both, now when i am selecting 2d carousel imageview then i want to change the image in the first carousel. i implemented this but for zero index of first carousel i am getting crash.. – Rajneesh071 Dec 05 '12 at 07:24
  • 1
    @Rajneesh071 It's awkward to answer questions in a comment - create a new StackOverflow question including your view controller code and I'll answer it there. – Nick Lockwood Dec 05 '12 at 10:30
  • @NickLockwood ok i will update u whenever question pasted by me:) – Rajneesh071 Dec 19 '12 at 10:55