iTofu / LCBannerView

A very popular and highly customized banner view! Infinite loop support!

Home Page:https://LeoDev.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scroll even if only one image

ac1dpax opened this issue · comments

How to prevent scrolling if array have only one image? I load images from internet and sometimes there is only one image then I don't want to scroll it.

commented

Fisrt update your pods: pod update

LCBannerView *bannerView = [[LCBannerView alloc] initWithFrame:CGRectMake(0, 20.0f, [UIScreen mainScreen].bounds.size.width, 200.0f)
                                                      delegate:self
                                                     imageName:@"banner"
                                                         count:3
                                                 timerInterval:3.0f
                                 currentPageIndicatorTintColor:[UIColor orangeColor]
                                        pageIndicatorTintColor:[UIColor whiteColor]];
bannerView.pageDistance = 20.0f;
bannerView.notScrolling = YES; // THIS LINE ⬅️
bannerView;
commented

If you load image from internet, I suggest you do this:

if urls.count == 1 {
    bannerView!.notScrolling = true
}

Nice! Thank you!