【发布时间】:2015-03-20 21:42:13
【问题描述】:
我想制作一个启用了换行的线性轮播(因此您可以在任一方向上无限滚动,它只会环绕)他们有一个 CarouselType.Linear,但它没有启用换行。任何人都知道如何使用 iCarousel 或 UICollectionViews 做到这一点?我找不到任何关于如何制作自定义 iCarousel 布局的好资源......那里有什么好的参考资料吗?
this.Carousel = new CarouselView(frame)
{
DataSource = new CylindericalDataSource(this),
Delegate = new CylindericalDelegate(this)
};
this.Carousel.CarouselType = CarouselType.Linear;
this.Carousel.ConfigureView();
this.View.AddSubview(this.Carousel);
------------编辑--------------
回答@Rahul 的问题
public override void DidScroll (CarouselView carouselView)
{
base.DidScroll (carouselView);
nint numOfItems = carouselView.NumberOfItems;
if (this._parentController != null &&
this._parentController._studioViewController != null &&
this._parentController._studioViewController.SuccessfullyReceivedProjectAndPageData () &&
this._parentController._studioViewController.HasFlowCardCarouselFinishedLoading () &&
numOfItems > 0)
{
// Enforce min and max values fro ScrollOffset so the user can't scroll the carousel off screen. This is required when wrapping is turned off.
nfloat maxScrollOffset = ((nfloat)numOfItems) - 1f;
nfloat minScrollOffset = 0f;
if (carouselView.ScrollOffset < minScrollOffset)
{
carouselView.ScrollOffset = minScrollOffset;
}
if (carouselView.ScrollOffset > maxScrollOffset)
{
carouselView.ScrollOffset = maxScrollOffset;
}
}
}
【问题讨论】:
标签: c# ios xamarin.ios uicollectionview icarousel