public void BeginAnimationWithViews(List<UIView> views, ScrollDirection direction=ScrollDirection.FromRight, float scrollSpeed=0.0f, int loops=0,ScrollingTickerAnimationCompletition completition=null) { if (isAnimating) EndAnimation(false); lazyLoadingHandler = null; animationCompletitionHandler = completition; numberOfLoops = loops; scrollViewDirection = direction; scrollViewSpeed = (scrollSpeed == 0 ? kLPScrollingAnimationPixelsPerSecond : scrollSpeed); if (displayLink!=null) { // Display link is used to catch the current visible area of the scrolling view during the animation displayLink.RemoveFromRunLoop(NSRunLoop.Main,NSRunLoop.NSDefaultRunLoopMode); displayLink = null; } LayoutTickerSubviewsWithItems(views); BeginAnimation(); }
public void BeginAnimationWithLazyViews(ScrollingTickerLazyLoadingHandler dataSource,List<NSValue>subviewsSizes,ScrollDirection direction=ScrollDirection.FromRight, float scrollSpeed=0.0f, int loops=0,ScrollingTickerAnimationCompletition completition=null) { if (isAnimating) EndAnimation(false); lazyLoadingHandler = dataSource; animationCompletitionHandler = completition; numberOfLoops = loops; scrollViewDirection = direction; scrollViewSpeed = (scrollSpeed == 0 ? kLPScrollingAnimationPixelsPerSecond : scrollSpeed); displayLink = CADisplayLink.Create(this,new Selector("tickerDidScroll")); displayLink.AddToRunLoop(NSRunLoop.Main,NSRunLoop.NSDefaultRunLoopMode); LayoutTickerSubviewsWithItemSizes(subviewsSizes); BeginAnimation(); }