Latest 0.3.2
License MIT
Platforms ios 8.0

1. Show a bar indicator at the bottom

2. Show a page control at the bottom



  1. Create a AHBannerView instance with a frame and a AHBannerStyle with your desired configurations.
  2. Setup the AHBannerView with an imageCount and the AHBannerStyle you just created
  3. Add the AHBannerView to a view.
  4. Assign and implement the delegate.

Example Codes

1. Basic Code

/// Create a AHBannerView
let bannerFrame = CGRect(x: 0, y: 64.0, width: self.view.bounds.width, height: 200.0)
        bannerView = AHBannerView(frame: bannerFrame)

/// Create a style
var style = AHBannerStyle()
   /// NOTE: This placeholder only appears when you haven't assigned a image for a imageView passed in the delegate method.
style.placeholder = UIImage(named: "placeholder")
style.isAutoSlide = true
//        style.isInfinite = false
//        style.isPagingEnabled = false
style.timeInterval = 1

/// Assigning delegate and add the bannerView to a view
bannerView.delegate = self

2.1 Style A: Show the bar indicator

style.bottomHeight = 5.0

style.showIndicator = true
style.showPageControl = false
style.indicatorColor =

style.showPageControl = false

2.2 Style B: Show the page control

style.bottomHeight = 25.0

style.showIndicator = false

style.showPageControl = true
style.showIndicator = false
style.pageControlColor = UIColor.gray
style.pageControlSelectedColor =

3. Implement the delegate in order to tell AHBannerView what to disdplay for each banner

/// NOTE: The this/that URL guard statement in the following, is for preventing images being mismatched and assigned to the wrong imageView, when the inital imageView being recyled before the initial image request callback gets called. It's the same idea applied when you deal with tableView/collectionView cells. 
func bannerViewForImage(_ bannerView: AHBannerView, imageView: UIImageView, atIndex: Int) {
  let thisURL = URL(string: self.images[atIndex])
  imageView.contentMode = .scaleAspectFill
  imageView.sd_setImage(with: thisURL) {[weak self] (image, _, _, thatURL) in
    guard self != self else {return}
    /// See the note above
    guard thisURL == thatURL else {return}
    guard let image = image else {return}
    imageView.image = image


To run the example project, clone the repo, and run pod install from the Example directory first.



AHBannerView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "AHBannerView"


Andy Tong, [email protected]


AHBannerView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "AHBannerView",
    "version": "0.3.2",
    "summary": "A banner view with infinite scrolling",
    "description": "A banner view with infinite scrolling experience",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Andy Tong": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.3.2"
    "platforms": {
        "ios": "8.0"
    "module_name": "AHBannerView",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    "source_files": "AHBannerView/Classes/**/*",
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This