0

I am trying to implement Images carousel View as per the below image. enter image description here

I want to display multiple images using carousel view with highlighted dots when user scroll the images (Highlight the respective dot below the image) in Xamarin IOS.

I tried with iCarousel - Xamarin Component ( iCarousel Link ) to display images with dots. Here i am able to display the images in carousel view. Can any one suggest me to resolve this issue.

1 Answer 1

0

You can add a UIPageControl underneath the iCarousel view:

UIPageControl pageControl = new UIPageControl(frame)); pageControl.Pages = carousel.NumberOfItems; pageControl.CurrentPage = carousel.CurrentItemIndex; // For some reason I needed to set the back ground color // for ValueChanged event to fire if you want pages to // change when the UIPageControl is tapped. pageControl.BackgroundColor = UIColor.Black; View.AddSubview(pageControl); 

Then handle the carousel.ScrollEnd event:

carousel.ScrollEnd += (sender, e) => { pageControl.CurrentPage = carousel.CurrentItemIndex; }; 

And if you want to be able to change the page by tapping the UIPageControl:

pageControl.ValueChanged += (sender, e) => { carousel.CurrentItemIndex = pageControl.CurrentPage; }; 

With a UIPageControl, you tap on the left or right of the control to go to the previous or next page, but you can't go to a specific page by clicking a dot. See: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPageControl_Class/index.html

I added the iCarousel Component sample with the UIPageControl added here: https://github.com/jgold6/XamarinSupportSamples/tree/master/iOS-iCarouselWithPageControl

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.