🔥A very popular and highly customized banner view! And, infinite loop!
心有猛虎,细嗅蔷薇。
This is a display of advertising or information.
If you feel good, please give me a star, thank you! ⭐️
You can using the images from local or internet.
LCBannerView is available on CocoaPods. Just add the following to your project Podfile:
pod "LCBannerView" # Podfile
Just drag the LCBannerView folder into your project.
- Use by including the following import:
#import "LCBannerView"
- Demo code:
// 1. from internet
[scrollView addSubview:({
LCBannerView *bannerView = [LCBannerView bannerViewWithFrame:CGRectMake(0, 300.0f, [UIScreen mainScreen].bounds.size.width, 200.0f)
delegate:self
imageURLs:URLs
placeholderImage:nil
timerInterval:2.0f
currentPageIndicatorTintColor:[UIColor redColor]
pageIndicatorTintColor:[UIColor whiteColor]];
bannerView;
})];
// 2. from local
// please find out the code from the demo
- Delegate (
@optional
):
- (void)bannerView:(LCBannerView *)bannerView didClickedImageIndex:(NSInteger)index;
- For example:
- (void)bannerView:(LCBannerView *)bannerView didClickedImageIndex:(NSInteger)index {
NSLog(@"you clicked image in %@ at index: %ld", bannerView, (long)index);
}
// logs
2015-11-30 17:36:20.611 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b751ff0; frame = (0 300; 375 200); layer = <CALayer: 0x7fc98b7521b0>> at index: 1
2015-11-30 17:36:21.292 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b433190; frame = (0 20; 375 200); layer = <CALayer: 0x7fc98b42ce20>> at index: 1
2015-11-30 17:36:21.801 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b751ff0; frame = (0 300; 375 200); layer = <CALayer: 0x7fc98b7521b0>> at index: 2
2015-11-30 17:36:22.380 LCBannerViewDemo[6075:456257] you clicked image in <LCBannerView: 0x7fc98b433190; frame = (0 20; 375 200); layer = <CALayer: 0x7fc98b42ce20>> at index: 3
- If you have any questions, please commit a issure! Thx!
- Email: [email protected]
- Blog: http://www.leodong.com