How to use UIPageControl with iCarousel?

I have some images within icarousel. (about 20 images)

I wanna 5 images in a page.

  • to prevent warning from “PerformSelect may cause a leak because its selector is unknown”
  • Hide device Volume HUD view while adjusitng volume with MPVolumeView slider
  • Using xib object inside another xib
  • How to get other application to paste from my global hotkey
  • How can I change modifier keys in “System Preferences > Keyboard > Modifier Keys…”
  • NSButton on NSVisualEffectView: Wrong Background Color
  • There is no problem about image pixel or image location.

    How to use uipagecontrol WITHOUT ScrollView?

    ex) able to use some delegate methods.. and so on.

    carousel.type = iCarouselTypeLinear;
        carousel  = [[iCarousel alloc] initWithFrame:CGRectMake(0, 504, 1024, 164)];
        carousel.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"10004.png"]];
        carousel.delegate = self;
        carousel.dataSource = self;
        [self.view addSubview:carousel];
        [carousel reloadData];
        [carousel release];
    
        UIView *bandImageView = [[UIView alloc] initWithFrame:CGRectMake(0, 668, 1024, 20)];
        bandImageView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"10001.png"]];
        [self.view addSubview:bandImageView]; // page dots in
    
        UIPageControl *pageControl = [[UIPageControl alloc] init];
        pageControl.frame = CGRectMake(434, 0, 150, 20); 
        pageControl.numberOfPages = 6; 
        pageControl.currentPage = 0; 
        [bandImageView addSubview:pageControl];
        [pageControl release];
    

    Solutions Collect From Internet About “How to use UIPageControl with iCarousel?”

    In the iCarousel carouselCurrentItemIndexUpdated: delegate method, set

    pageControl.currentPage = carousel.currentItemIndex / 5
    

    Then bind your pageControl action to a method like the one below:

    - (IBAction)updatePage:(UIPageControl *)pageControl
    {
        [carousel scrollToItemAtIndex:pageControl.currentPage * 5 aimated:YES];
    }
    

    If you’re not using a nib file, you can bind the action using

    [pageControl addTarget:self action:@selector(updatePage:) forControlEvents:UIControlEventValueChanged];
    

    It’s a good idea to set pageControl.defersCurrentPageDisplay = YES; as well to avoid flicker.