Latest 0.0.6
Homepage https://github.com/TernTuring/TernBannerView
License MIT
Platforms ios 9.0, requires ARC
Authors

Example

TernBannerView

Requirements

  • iOS 9.0+
  • Xcode 10.0+

Installation

Use CocoaPods with Podfile:

pod 'TernBannerView'

Features

  • [x] self-customized the banner Height
  • [x] Infinite loop scrolling view
  • [x] Support Autolayout
  • [x] Supports whether PageController is displayed

Usage

1) Init View:

TernBannerView *banner = [[TernBannerView alloc] init:TernBannerDataImage];
banner.delegate = self;
banner.dataSource = self;
banner.showPageController = YES;
banner.bannerHeight = 160;
banner.autoLoop = YES;
[banner setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:banner];

NSDictionary *constraintsView = NSDictionaryOfVariableBindings(banner);

[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-50-[banner(160)]" options:0 metrics:nil views:constraintsView ]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[banner]-0-|" options:0 metrics:nil views:constraintsView ]];

2) Implement TernBannerViewDelegate delegate in your class:

- (void)bannerView:(TernBannerView *)bannerView didSelectItemAtIndex:(NSInteger)index {

}

3) Implement TernBannerViewDataSource datasource in your class:

- (NSInteger)numberItemsOfBanner:(TernBannerView *)bannerView {
    return 4;
}

- (UIImage *)bannerView:(TernBannerView *)bannerView cellForItemAtIndex:(NSInteger)index {
    return [UIImage imageNamed:@"banner.png"];
}

Licence

TernBannerView is released under the MIT license.
See LICENSE for details.

Latest podspec

{
    "name": "TernBannerView",
    "version": "0.0.6",
    "summary": "A clean and simple banner for iPhone and iPad",
    "homepage": "https://github.com/TernTuring/TernBannerView",
    "authors": {
        "TernTuring": "[email protected]"
    },
    "license": "MIT",
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/TernTuring/TernBannerView.git",
        "tag": "0.0.6"
    },
    "source_files": "TernBannerView/*.{h,m}"
}

Pin It on Pinterest

Share This